1. Where are the types of arrays in C#?
2. 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.
Ans. An object is an instance of a class.
3. Define destructors?
Ans. 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 precided by a tilde.
4. What is the use of enumerated data type?
Ans. 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.
5. Define Constructors?
Ans. 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.
6. What is encapsulation?
Ans. 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.
7. Can you inherit multiple interfaces?
Ans. Yes. Multiple interfaces may be inherited in C#.
8. What is inheritance?
Ans. Inheritance is deriving the new class from the already existing one.
9. Define scope?
Ans. Scope refers to the region of code in which a variable may be accessed.
10. What is the difference between public, static and void?
Ans. public :The keyword public is an access modifier that tells the C# compiler that the Main method is accessible by anyone.
static :The keyword static declares that the Main method is a global one and can be called without creating an instance of the class. The compiler stores the address of the method as the entry point and uses this information to begin execution before any objects are created.
void : The keyword void is a type modifier that states that the Main method does not return any value.