revisions: 10/05/2003, 12/28/2018


Quiz on Inheritance

Instructions: For each question, choose the single best answer. Make your choice by clicking on its button. You can change your answers at any time. When the quiz is graded, the correct answers will appear in the box after each question.


1. What type of inheritance does Java have?

A.    single inheritance

B.    double inheritance

C.    multiple inheritance

D.    class inheritance

Correct Answer:


2. Can an object be a subclass of another object?

A.    Yes — as long as single inheritance is followed.

B.    No — inheritance is only between classes.

C.    Only when one has been defined in terms of the other.

D.    Yes — when one object is used in the constructor of another.

Correct Answer:


3. What is true about using super reference in a constructor?

A.    It can only be used in the parent's constructor.

B.    Only one child class can use it.

C.    It must be used in the last statement of the constructor.

D.    It must be in the first statement of the constructor.

Correct Answer:


4. Say that Honda is a subclass of Car. Each class includes a run() method as part of its definition. If the variable honda refers to a Honda, what does the following code do?

honda.run();

A.    The run() method defined in Honda is called.

B.    The run() method defined in Car is called.

C.    The compiler will complain that run() has been defined twice.

D.    Overloading determines which run() to call.

Correct Answer:


5. Does a child class inherit both variables and methods from its parent?

A.    No — only variables are inherited.

B.    No — only methods are inherited.

C.    Yes — both are inherited.

D.    Yes — but only those marked public are inherited.

Correct Answer:


The number you got right:       Percent Correct:       Letter Grade:   


Click here If you have returned here from another page, or have re-loaded this page, you will need to click again on each of your choices for the grading program to work correctly. You may want to press the SHIFT KEY while clicking to clear the old answers.