Jun 12

Basic C# Interview Questions and Answers

11. What are the modifiers in C#?

  • Abstract
  • Sealed
  • Virtual
  • Const
  • Event
  • Extern
  • Override
  • Readonly
  • Static
  • New

12. What are the types of access modifiers in C#?

Access modifiers in C# are :

  • public
  • protect
  • private
  • internal
  • internal protect

13. What is boxing and unboxing?

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.

14. What is object?

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 behaviors (or methods) of that specific object.

15. Where are the types of arrays in C#?

  1. Single-Dimensional
  2. Multidimensional
  3. Jagged arrays.

16. What is the difference between Object and Instance?

An instance of a user-defined type is called an object. We can instantiate many objects from one class.

An object is an instance of a class.

17. Define destructors?

A destructor is called for a class object when that object passes out of scope or is explicitly deleted.A destructors as the name implies is used to destroy the objects that have been created by a constructors.Like a constructor , the destructor is a member function whose name is the same as the class name but is precised by a tilde.

18. What is the use of enumerated data type?

An enumerated data type is another user defined type which provides a way for attaching names to numbers thereby increasing comprehensibility of the code. The enum keyword automatically enumerates a list of words by assigning them values 0,1,2, and so on.

19. Define Constructors?

A constructor is a member function with the same name as its class. The constructor is invoked whenever an object of its associated class is created.It is called constructor because it constructs the values of data members of the class.

20. What is encapsulation?

The wrapping up of data and functions into a single unit (called class) is known as encapsulation. Encapsulation containing and hiding information about an object, such as internal data structures and code.

Permanent link to this article: http://zappmania.in/2014/06/12/basic-c-interview-questions-answers.htm

Leave a Reply

Your email address will not be published.