Top 11 C# Oops Interview Questions You Must Prepare 26.Apr.2024

'this' pointer refers to the current object of a class.

  • Constant variables are declared and initialized at compile time. The value can't be changed after words.
  • Readonly variables will be initialized only from the non-static constructor of the same class.
  • Static Readonly variables will be initialized only from the static constructor of the same class.

No. A class cannot inherit the constructor of its base class.

No. Whenever, an exception occurs in your program, the correct catch block is executed and the control goes to the finally block.

An argument passed as "ref" must be initialized before passing to the method whereas "out" parameter needs not to be initialized before passing to a method, and it will be initialized inside the method.

No, we cannot inherit private members of a class because private members are accessible only to that class and not outside that class.

Yes. By Declaring the class public and making the method sealed.

Yes. You can prevent a class from overriding in C# by using the sealed keyword; and in VB by using NotInheritable keyword.

The using block is used to obtain a resource and use it and then automatically dispose off when the execution of block completed.