.Net Object Oriented Programming Interview Questions and Answers for Freshers and Experience Part-2
A collection can be defined as a group of related items that can be referred to as a single unit. TheSystem.Collections namespace provides you with many classes and interfaces. Some of them are -ArrayList, List, Stack, ICollection, IEnumerable, and IDictionary. Generics provide the type-safety to your class at the compile time. While creating a data structure, you never need to specify the data type at the time of declaration. The System.Collections.Generic namespace contains all the generic collections.
8. How can you prevent your class to be inherited further?
You can prevent a class from being inherited further by defining it with the sealed keyword.
9. What is the index value of the first element in an array?
In an array, the index value of the first element is 0 (zero).
10. Can you specify the accessibility modifier for methods inside the interface?
All the methods inside an interface are always public, by default. You cannot specify any other access modifier for them.
11. Is it possible for a class to inherit the constructor of its base class?
No, a class cannot inherit the constructor of its base class.
12. How is method overriding different from method overloading?
Overriding involves the creation of two or more methods with the same name and same signature in different classes (one of them should be parent class and other should be child).
Overloading is a concept of using a method at different places with same name and different signatures within the same class.