Recall & Review
beginner
What is partial abstraction in Java?
Partial abstraction means a class has some methods with implementation and some without. It is done using <code>abstract</code> classes that can have both abstract and concrete methods.Click to reveal answer
beginner
How do you declare an abstract method in Java?
Use the
abstract keyword before the method signature and do not provide a body. For example: abstract void display();Click to reveal answer
beginner
Can you create an object of an abstract class?
No, you cannot create an object of an abstract class directly. You must create a subclass that implements the abstract methods and then create an object of that subclass.Click to reveal answer
intermediate
Why use partial abstraction instead of full abstraction?
Partial abstraction lets you share common code in the abstract class while forcing subclasses to provide specific details. It helps avoid code duplication and provides a template for subclasses.Click to reveal answer
beginner
Example of a partial abstraction in Java?
An abstract class
Animal with an abstract method sound() and a concrete method sleep(). Subclasses like Dog implement sound().Click to reveal answer
Which keyword is used to declare a class with partial abstraction in Java?
✗ Incorrect
The
abstract keyword declares a class that can have both abstract and concrete methods.Can an abstract class have implemented methods?
✗ Incorrect
Abstract classes can have both abstract methods (without body) and concrete methods (with body).
What happens if a subclass does not implement all abstract methods?
✗ Incorrect
If a subclass does not implement all abstract methods, it must also be declared abstract.
Which of these is NOT true about partial abstraction?
✗ Incorrect
Partial abstraction means some methods have code; not all methods are abstract.
Why might you choose partial abstraction over interfaces?
✗ Incorrect
Partial abstraction allows sharing common code in abstract classes, unlike interfaces which traditionally only declare methods.
Explain partial abstraction in Java and how it differs from full abstraction.
Think about classes that have some methods with code and some without.
You got /5 concepts.
Describe a simple example of partial abstraction using an abstract class and a subclass.
Use an animal or vehicle example.
You got /4 concepts.