Abstraction QuizS2C Home « Abstraction Quiz

OO Concepts Quiz 8

The quiz below tests your knowledge of the material learnt in OO Concepts - Lesson 8 - Abstraction.

Question 1 : What are non-abstract classes called?
- Non-abstract classes are called <i>concrete</i> classes.
Question 2 : Abstract methods must be implemented in the first subclass?
- Abstract methods must be implemented in the first <i>concrete subclass</i>.
Question 3 : How do we instantiate an abstract class?
- We can't instantiate an <i>abstract</i> class.
Question 4 : Is the following code snippet valid?

public abstract class A {
    public abstract void load();
}

public class B extends A {
    public abstract void load();
}
- The code will not compile as class <code>B</code> is not abstract and doesn't implemement the abstract method from class <code>A</code>.
Question 5 : What is unusual about an abstract method?
- An <i>abstract</i> method has no body.
Question 6 : You can declare a class as abstract and final?
- The <code>abstract</code> and <code>final</code> keywords are mutually exclusive when applied to a class as abstracted classes need to be extended whereas final classes cannot be extended.
Question 7 : What are the implications of putting an abstract method in a class?
- Putting an <i>abstract</i> method in a class makes the class <i>abstract</i>, which means the class must be declared <i>abstract</i>.
Question 8 : Is the following code snippet valid?

public abstract class A {
    public abstract void load();
}

public abstract class B extends A {
    public abstract void load(String payload);
}
- The code will compile fine but both of these methods would have to be implemented in the first concrete subclass.
Question 9 : What does abstraction prohibit in a class?
- Abstraction prohibits instantiation.
Quiz Progress Bar Please select an answer


What's Next?

In the next quiz we test your knowledge of polymorphism.