Monday, September 10, 2012

OOPs Reasoning FAQs-2

S.NoQuestionsAnswers
1Can you create an instance of a static class ?No, we cannot create an instance of a static class.
2
Are Value types sealed ?

Yes, Value types are sealed.
3Can a static class contain non static members?No, a static class can contain only static members
4Can a struct inherit from another struct or class in C#?No, a struct cannot inherit from another struct or class, and it cannot be the base of a class.
5Can you instantiate a struct without using a new operator in C#?Yes, we can instantiate a struct without using a new operator
6Can a struct have a default constructor (a constructor without parameters) or a destructor in C#?No
7Do structs support inheritance?No, structs do not support inheritance, but they can implement interfaces.
8Can a sealed class be used as a base class?No, sealed class cannot be used as a base class. A compile time error will be generated.
9Can you create an instance of an abstract class?No, abstract classes are incomplete and you cannot create an instance of an abstract class.
10Can destructors have access modifiers?No, destructors cannot have access modifiers.

No comments:

Post a Comment