Self-Assessment Exercises
Chapter 8:
Specialization and Inheritance
1.
The ________ keyword is used to make a field visible to a specific class and classes derived from that class.
a.
private
b.
protected
c.
public
d.
visible
2.
If you are using the
super
keyword to invoke the constructor of a base class, then ________.
a.
you must do so from the constructor of a derived class
b.
the call to
super
must be the first statement within the constructor
c.
the call to
super
must match the signature of a valid constructor in the base class
d.
All of the above
3.
The three pillars of object-oriented design are ________.
a.
classes, fields, and methods
b.
classes, interfaces, and objects
c.
encapsulation, polymorphism, and specialization
d.
private, protected, and public
4.
An object can have an “is a” relationship with ________ class(es).
a.
at most one
b.
exactly one
c.
many
d.
None of the above; objects do not have "is a" relationships
5.
What is true of an abstract base class named
Base
?
a.
Base
can have methods which do not have implementations.
b.
Base
can be instantiated.
c.
Any derived class of
Base
must implement all of
Base
’s methods.
d.
All of the above