1. A child class is not allowed to
False
define a method with the same
name and pa- rameter list as a Having a method with the same name
method in the parent class. and para- meter list is called "over-riding"
and is a common practice for inheritance,
Question 1
e.g. see message() for the Thought and
Select one: True or False
Advice classes.
2. Of the classes below, the one
that is most likely to be
Animal
declared abstract is
. The higher a class is in a UML inheritance
tree, the more likely it is to be abstract.
Question 2
Select one:
a. Bat
b. Squirrel
c. Animal
d. Iguana
e. Parrot
3. In Java, subclass can only extend True
one parent class.
Java only supports single inheritance.
Question 3
Select one: True or False
4. In order for derived classes to
protected
have access to encapsulated data
members
and methods of superclasses, the data Protected makes the element available
to child
members and methods should be de- clared using the
1/
17
,COMP 1231 QUIZZES AND ANSWERS VERIFIED TO PASS 2025
modifier. classes, but it would act as private outside of
the parent and child classes.
Question 4
2/
17
, COMP 1231 QUIZZES AND ANSWERS VERIFIED TO PASS 2025
Select one:
a. private
b. public
c. protected
d. final
e. static
5. A class declared as final cannot be used True
as a basis for inheritance.
A method declared as final cannot be over-
Question 5 ridden during inheritance, while a class
Select one: True or False declared as final cannot be extended at all.
6. When a variable is declared in a shadow
sub- class and has the same
name as a vari-
able declared in a superclass, it is called A shadow variable will have the
context in the sub-
a variable. Select
one:
Question 6 a. super
Select one:
a. final
b. shadow
c. static
d. dead
e. This is not allowed in Java.
7. Which of the following key words
indi- cates a new class is being
derived from an existing class?
Question 7
3/
17