Polymorphism QuizS2C Home « Polymorphism Quiz

OO Concepts Quiz 9

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

Question 1 : What is required to use polymorphism?
- We need to have an inheritance hierarchy to use polymorphism, although abstracting out generic methods to force implementation in subclasses helps to enforce it.
Question 2 : What do we use in the declaration of an object to enable polymorphism?
- We use the supertype of the object we are creating
Question 3 : What are used for polymorphism?
- <i>overridden</i> instance methods are used in polymorphism.
Question 4 : We use overloaded methods in polymorphism?
- We DO NOT use <i>overloaded</i> methods in polymorphism we use <i>overridden</i> methods.
Question 5 : What is the following code snippet an example of?

public class A {
    public static void aClassMethod() {
    }
}
public class B extends A {
    public static void aClassMethod() {
    }
}
- This is an example of <i>hiding</i>.
Question 6 : We can make the arguments to our methods polymorphic?
- We CAN make the arguments to our methods polymorphic.
Question 7 : What is the dynamic selection of overridden methods at runtime based on the actual object type, rather than the reference type known as?
- This concept is known as <i>virtual method invocation</i>.
Question 8 : We can invoke a static supertype method from a non-static subtype method?
- We CANNOT invoke a static <i>supertype</i> method from a non-static <i>subtype</i> method as our instance methods know nothing of static members and this will not compile anyway.
Quiz Progress Bar Please select an answer


What's Next?

In the next quiz we take a first look at interfaces.