Object oriented programming .Net interview questions and answers, oops concept in .NET, Dot NET interview Questions and answers.
Hi to all Iam sharing More .NET interview Question and answers on Concept : OBJECT ORIENTED PROGRAMMING.
Hi to all Iam sharing More .NET interview Question and answers on Concept : OBJECT ORIENTED PROGRAMMING.
1. Define enumeration ?
Enumeration
is defined as the value type that consists of a set of named values.
These values are constants and are called enumerators. A enumeration
type is declared using the enum keyword. Each
enumerator in an enumeration is associated with an underlying type that
is set, by default, on the enumerator. The following is an example that
creates an enumeration to store different varieties of fruits:
enum Fruits {Mango, Apple, orange, Guava};
In the preceding example, we have seen that an enumeration Fruits is created, where number 0 is associated with Mango, number 1 with Apple, number 2 with Orange, and number 3 with Guava. You can access the enumerators of an enumeration by these values.
enum Fruits {Mango, Apple, orange, Guava};
In the preceding example, we have seen that an enumeration Fruits is created, where number 0 is associated with Mango, number 1 with Apple, number 2 with Orange, and number 3 with Guava. You can access the enumerators of an enumeration by these values.
2. In which namespace all the .NET collection classes are contained?
IN System.Collections namespace contains all the collection classes are contained.
3.. Is it good practice to the handle exceptions in code?
Yes,
you must handle the exceptions in code so that you can deal with any
unexpected situations that occur when a program is running. For example,
dividing a number by zero or passing a string value to a variable that
holds an integer value would result in an exception.
4. Explain concept of constructor?
Constructor
is a special method of a class, which is called automatically when the
instance of a class is created. It is created with the same name as the
class and initializes all class members, whenever you access the class.
The main features of a constructor are
- Constructors do not have any return type
- Constructors are always public
- It is not mandatory to declare a constructor; it is invoked automatically by .NET Framework.
5. Can you the inherit private members of a class?
No you cannot inherit private members of a class.
6. Does THe .NET support multiple inheritance?
NO .NET
does not support multiple inheritance directly because in .NET, a class
cannot inherit from more than one class. .NET supports multiple
inheritance through interface.
More questions will be updated soon
More questions will be updated soon
ConversionConversion EmoticonEmoticon