Course: Easy-to-follow Java programming
The quiz questions
Answer the questions below to review what you have learned in Video 8. You will
find the right answers after the questions in the solution section.
1. What is inheritance?
An object deleted from memory passes on its resources (e.g. memory)
to another object.
You create a new class out of an existing one.
Modification of methods.
We create the object without knowing its class.
2. What can you do during the inheritance process?
Set multiple superclasses.
Remove methods.
Create new data members.
Create new methods.
Prescribe which object will receive the resources of the deleted
one.
Duckademy IT courses – www.duckademy.com
3. In the following statement what can you use instead of the question mark
(?)? There is a superclass A, which has a subclass B, and there is a C which
is the subclass of B.
? x = new B();
B
C
Object
String
4. Complete the following sentences:
If you put the final keyword in front of a variable, then the value ca nno.
If a data member is an object, the final keyword refers to tthe referencet, not to
tthe valuet.
If a class is denoted with final, then you cannot tinherit fromt the class.
If a method is final in a class, then the method cannot tbe overriddent in the
subclasses.
5. Select which statements are true:
A class in Java can have only one superclass.
Multiple inheritance is designated by rectangles in a UML class diagram.
The interfaces were created to partially support multiple inheritance.
An interface can have multiple super-interfaces.
Object is an interface.
Duckademy IT courses – www.duckademy.com
----------------------------------------------------------------------------------------------------------------
The answers
1. What is inheritance?
An object deleted from memory passes on its resources (e.g. memory)
to another object.
X You create a new class out of an existing one.
Modification of methods.
We create the object without knowing its class.
2. What can you do during the inheritance process?
Set multiple superclasses.
Remove methods.
X Create new data members.
X Create new methods.
Prescribe which object will receive the resources of the
deleted one.
X Modify existing methods.
3. In the following statement what can you use instead of the question mark
(?)? There is a superclass A, which has a subclass B, and there is a C which
is the subclass of B.
? x = new B();
X A
X B
C
X Object
String
Duckademy IT courses – www.duckademy.com
4. Complete the following sentences:
If you put the final keyword in front of a variable, then the value cannot bet
tchangedt.
If a data member is an object, the final keyword refers to tthe referencet, not to
tthe valuet.
If a class is denoted with final, then you cannot tinherit fromt the class.
If a method is final in a class, then the method cannot tbe overriddent in the
subclasses
5. Select which statements are true:
X A class in Java can have only one superclass.
Multiple inheritance is designated by rectangles in a UML class diagram.
X The interfaces were created to partially support multiple inheritance.
X An interface can have multiple super-interfaces.
Object is an interface.
Duckademy IT courses – www.duckademy.com