C# Interview Questions and Answers Part 13

1. What is an Abstract class?

Ans. An abstract class is a special kind of class that cannot be instantiated. It normally contains one or more abstract methods or abstract properties. It provides body to a class.

2. What is an Interface?

Ans. An interface has no implementation; it only has the signature or in other words, just the definition of the methods without the body.

3. What is Inheritance?

Ans. It is a process of acquiring attributes and behaviors from another object (normally a class or interface).

4. What is Polymorphism?

Ans. Mean by more than one form. Ability to provide different implementation based on different number/type of

parameters.

5. What is Pure-Polymorphism?

Ans. When a method is declared as abstract/virtual method in a base class and which is overridden in a base class. If we create a variable of a type of a base class and assign an object of a derived class to it, it will be decided at a run time, which implementation of a method is to be called. This is known as Pure-Polymorphism or Late-Binding.

6. What is a Constructor?

Ans. A special Method Always called whenever an instance of the class is created.

7. What is a Destructor?

Ans. A special method called by GC. just before object is being reclaimed by GC.

8. How a base class method is hidden?

Ans. Hiding a base class method by declaring a method in derived class with keyword new. This will override the base class method and old method will be suppressed.

9. What Command is used to implement properties in C#?

Ans. get & set access modifiers are used to implement properties in c#.

10. What is method overloading?

Ans. Method overloading is having methods with same name but carrying different signature, this is useful when you want a method to behave differently depending upon a data passed to it.



Subscribe

Receive Quality Tutorials Straight in your Inbox by submitting your Email below:

Delivered by FeedBurner

Protected by Copyscape Duplicate Content Checker