Thursday, September 6, 2012

OOPs Reasoning FAQs-2

OOPs Reasoning FAQs-2

S.No
Questions
Answers
1
Can 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.
3
Can a static class contain non static members?
No, a static class can contain only static members
4
Can 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.
5
Can you instantiate a struct without using a new operator in C#?
Yes, we can instantiate a struct without using a new operator
6
Can a struct have a default constructor (a constructor without parameters) or a destructor in C#?
No
7
Do structs support inheritance?
No, structs do not support inheritance, but they can implement interfaces.
8
Can 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.
9
Can you create an instance of an abstract class?
No, abstract classes are incomplete and you cannot create an instance of an abstract class.
10
Can destructors have access modifiers?
No, destructors cannot have access modifiers.

No comments:

Post a Comment