C# Experienced Interview Questions.

Q1-Does C# support mulitple inheritance?

Ans: No

Q2-Every object is derived from system.object class and now in this condition if we create a class and derived this class from some base class then its means it is inherited by two class one system.objec and other is your base class then why we say that c# does not support multiple inheritance?

Class A:System.Object //c# standard-every object is derived from system.object class

Class B: A ()
means class B is inherited by two classes Class A and Class System.Object then how it is possible?

Ans: Actually when c# compiler notify colen (:) and then class it breaks the relation from System.Object class. Basically after breaking relation from System.Object class it is inherited by base class A and this base class A get inherited from Syste.Object base class so there is no impact on Class B.

Q3-Why multiple Inheritance is not possible in C#?
Ans: As you all know that in C++ there was a major problem known as "Dimond Ring Problem" which causing calling method naming confliction,To avoid this c# removed the concept of multiple inheritance instead of this the new concept provided by the C# is Multiple Interface Inheritance.

Q4:Does private members of base class inherited into derived class?
Ans: Yes , It is inherited but not accessible.

Q5:How can I prevent my class to be inherited?
Ans: Use sealed keyword before class name.The sealed class can't be inherited.

Q6:How many types of inheritance supported by c#?
Ans: Two types of inheritance:

Implementation inheritance
Interface inheritance

Implementation inheritance-- When a class (type) is derived from another class(type) such that it inherits all the members of the base type it is Implementation Inheritance

Interface inheritance-- When a type (class or a struct) inherits only the signatures of the functions from another type it is Interface Inheritance

Inheritance Usage Example:
Here is a syntax example for using Implementation Inheritance
Class derivedClass:baseClass{}
derivedClass is derived from baseClass Interface Inheritance example:
private Class derivedClass:baseClass , InterfaceX , InterfaceY {}

Q7: How to use asp.net user control dynamically?
Ans:  Write this code on page load.....
        Control cntrl = LoadControl("../../WebUserControl1.ascx");
        Controls.Add(cntrl);

Q8: Can interface contains fields?
Ans: No, Only methods and properties.

Q8: What is the name of actual work process in IIS6.0/IIS5.0 for asp.net?
Ans:     IIS5.0- Aspnet_wp.exe
            IIS6.0- w3wp.exe