Govt. Exams
Entrance Exams
Advertisement
Topics in C# Programming
Which of the following correctly demonstrates an abstract class with an abstract method in C#?
Correct Answer:
A. public abstract class Base { public abstract void Method(); }
EXPLANATION
An abstract class uses the 'abstract' keyword, and abstract methods must be declared without implementation inside abstract classes.
In C#, can a class inherit from multiple classes?
Correct Answer:
B. No, C# does not support multiple inheritance
EXPLANATION
C# does not support multiple class inheritance to avoid the diamond problem. However, a class can implement multiple interfaces.
Which keyword is used to create a derived class in C#?
Correct Answer:
C. :
EXPLANATION
In C#, the colon (:) is used to indicate inheritance. For example, 'class Child : Parent' creates a derived class.
In C#, what is the default access modifier for class members?
Correct Answer:
B. private
EXPLANATION
The default access modifier for class members in C# is 'private', which restricts access to within the class only.