C# Interview Questions and Answers Part 16

1. What are the modifiers in C#?
Ans. Abstract, Sealed, Virtual, Const, Event, Extern, Override, Readonly, Static, New

2. What are the types of access modifiers in C#?
Ans. Access modifiers in C# are : public, protect, private, internal, internal protect

3. What is boxing and unboxing?
Ans.Implicit conversion of value type to reference type of a variable is known as BOXING, for example integer to object type conversion.
    Conversion of reference type variable back to value type is called as UnBoxing.

4. What is object?
Ans.An object is an instance of a class. An object is created by using operator new. A class that creates an object in memory will contain the information about the values and behaviours (or methods) of that specific object.

5. Does c# support multiple inheritance?
Ans. No,its impossible which accepts multi level inheritance.

6. What is ENUM?
Ans. Enum are used to define constants.

7. What is a data set?
Ans. A DataSet is an in memory representation of data loaded from any data source.

8. What is the difference between private and public keyword? 
Ans.
Private : The private keyword is the default access level and most restrictive among all other access levels.
          It gives least permission to a type or type member.
      A private member is accessible only within the body of the class in which it is declared.
Public  : The public keyword is most liberal among all access levels, with no restrictions to access what so ever.
          A public member is accessible not only from within, but also from outside, and gives free access to any member declared within the body or outside the body.

9. What is the difference between ref & out parameters?
Ans. An argument passed to a ref parameter must first be initialized. Compare this to an out parameter, whose argument does not have to be explicitly initialized before being passed to an out parameter.

10. What are the different categories of inheritance?
Ans.
In C# inheritance may be implemented in different combinations as illustrated in figure and they include:
Inheritance in Object Oriented Programming is of four types:
Single inheritance: Contains one base class and one derived class.
Hierarchical inheritance: Contains one base class and multiple derived classes of the same base class.
Multilevel inheritance: Contains a class derived from a derived class.
Multiple inheritances: Contains several base classes and a derived class.






Subscribe

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

Delivered by FeedBurner

Protected by Copyscape Duplicate Content Checker