Recall & Review
beginner
What is an abstract class in C#?An abstract class is a class that cannot be instantiated on its own and is meant to be a base class. It can contain abstract methods (without implementation) that derived classes must implement.Click to reveal answer
beginner
What is a concrete class in C#?A concrete class is a class that can be instantiated directly. It provides full implementations of its methods and can be used to create objects.Click to reveal answer
intermediate
When should you use an abstract class instead of a concrete class?Use an abstract class when you want to define a common base with shared code and require derived classes to implement specific methods. It helps enforce a contract and reuse code.Click to reveal answer
beginner
Can you instantiate an abstract class directly?No, you cannot create an instance of an abstract class directly. You must create an instance of a derived concrete class.Click to reveal answer
intermediate
Give a real-life example of when to use an abstract class.
Imagine a base class 'Vehicle' that defines common features like 'StartEngine' but leaves the 'Drive' method abstract because cars and boats drive differently. Concrete classes like 'Car' and 'Boat' implement 'Drive'.
Click to reveal answer
Which statement about abstract classes in C# is true?
✗ Incorrect
Abstract classes cannot be instantiated directly; they serve as base classes.
When should you use a concrete class?
✗ Incorrect
Concrete classes provide full implementations and can be instantiated.
What happens if a class inherits from an abstract class but does not implement its abstract methods?
✗ Incorrect
Derived classes must implement abstract methods or be declared abstract themselves.
Which of these is NOT a reason to use an abstract class?
✗ Incorrect
Abstract classes cannot be instantiated directly.
If you want to define a method that must be implemented differently by each subclass, you should:
✗ Incorrect
Abstract methods require subclasses to provide their own implementation.
Explain the difference between abstract and concrete classes and when to use each.
Think about base classes and objects you can create.
You got /5 concepts.
Describe a real-world scenario where an abstract class is useful.
Consider something like vehicles or animals.
You got /4 concepts.