C Sharp Inheritance Questions and Answers
C# Inheritance questions with answers are key for understanding object-oriented programming concepts in C#. Inheritance allows one class to acquire properties and methods of another, promoting code reusability and modular design. These programming questions and answers with explanations are often featured in technical interview Q&A for companies like Microsoft, Cognizant, and TCS. Practicing C# MCQs on inheritance helps learners grasp concepts like base and derived classes, access modifiers, method overriding, and polymorphism. Regular practice using C# programming interview questions with answers ensures strong command over object-oriented design principles for both academic and professional success.
C Sharp Inheritance
Showing 10 of
29 questions
11. What keyword is used to implement inheritance in C#?
- extends
- inherits
- implements
- colon (:)
12. Which class cannot be inherited in C#?
- Abstract class
- Sealed class
- Static class
- Partial class
14. Which access modifier allows a member to be accessible only within its own class and derived classes?
- private
- public
- internal
- protected
15. What keyword is used to call the base class constructor from a derived class?
- super
- this
- base
- parent
16. Which of the following is true about abstract classes?
- They can be instantiated
- They cannot have abstract methods
- They cannot be inherited
- They must be inherited to be used
17. What is the main purpose of the "virtual" keyword in C#?
- To make method static
- To prevent method overriding
- To allow method overriding
- To make method private
18. Which keyword is used to override a method in a derived class?
- overrides
- new
- override
- virtual
19. What happens if a class does not explicitly inherit from any class?
- It becomes a sealed class
- It inherits from Object class
- It causes compilation error
- It becomes an abstract class
20. Which of the following can implement multiple inheritance in C#?
- Abstract classes
- Sealed classes
- Interfaces
- Static classes