Top 11 C# Oops Interview Questions
Q1. What Is 'this' Pointer?
'this' pointer refers back to the present day object of a class.
Q2. Difference Between Const, Readonly And Static Readonly In C# ?
Constant variables are declared and initialized at compile time. The fee can not be changed after phrases.
Readonly variables will be initialized handiest from the non-static constructor of the same magnificence.
Static Readonly variables might be initialized only from the static constructor of the identical class.
Q3. Is It Possible For A Class To Inherit The Constructor Of Its Base Class?
No. A class can't inherit the constructor of its base class.
Q4. Is It Possible To Execute Two Catch Blocks?
No. Whenever, an exception occurs in your application, the appropriate capture block is achieved and the control is going to the eventually block.
Q5. You Declare An Overridden Method To Be Static If The Original Method Is Not Static?
No. Two digital techniques must have the equal signature.
Q6. What's The Difference Between The 'ref' And 'out' Keywords?
An argument passed as "ref" ought to be initialized earlier than passing to the method while "out" parameter desires not to be initialized before passing to a method, and it'll be initialized inside the method.
Q7. Can You Inherit Private Members Of A Class?
No, we can not inherit private members of a category due to the fact non-public contributors are on hand handiest to that class and now not out of doors that magnificence.
Q8. Can You Allow A Class To Be Inherited, But Prevent A Method From Being Overridden In C#?
Yes. By Declaring the class public and making the method sealed.
Q9. Can You Prevent A Class From Overriding?
Yes. You can prevent a class from overriding in C# with the aid of the usage of the sealed key-word; and in VB by way of the usage of NotInheritable key-word.
Q10. Why To Use "the use of" Statement In C#?
The the usage of block is used to acquire a resource and use it and then robotically dispose off when the execution of block finished.
Q11. Can 'this' Be Used Within A Static Method?
No.
