Download presentation
Presentation is loading. Please wait.
1
PreAP Computer Science Quiz 09.01- 06 Key
Take out a piece of paper and PEN. The quiz starts ONE minute after the tardy bell rings. You will have 30 or 45 seconds per question.
2
Title the quiz as shown below The quiz starts in ONE minute.
Name Period Date Quiz EC.
3
Question 01 Inheritance describes what type of relationship? “is-a”
“has-a”
4
Question 02 Composition describes what type of relationship? “is-a”
“has-a”
5
Question 03 Which of the following shows an example of an inheritance relationship? dog cat house door hanger shelf student person 5
6
Question 04 Which of the following shows an example of a composition relationship? dog cat house door hanger shelf student person 6
7
Question 05 Inheritance involves the use of at least two
classes. The existing (and more general) class is called the superclass. default class. overloaded class. subclass.
8
Question 06 Inheritance involves the use of at least two
classes. The new and improved class which uses inheritance is called the superclass. default class. overloaded class. subclass.
9
Question 07 Which single Java keyword indicates that
inheritance is used? isa hasa extends inherits
10
Question 08 True or False When an object of a subclass is instantiated, the constructor of the superclass is called first. True (b) False
11
Question 09 True or False Methods of a subclass have access to the
private data of a superclass. True False
12
Question 10 True or False Methods of a subclass have access to the
public data of a superclass. True False
13
Question 11 True or False Methods of a subclass have access to the
protected data of a superclass. True False
14
Question 12 The Geometry analogy which states that
a square is a rectangle is an example of encapsulation. concatenation. inheritance. polymorphism. composition.
15
Question 13 How should super class data be declared if you want to grant direct access to subclass methods, but you do not want to grant direct access to methods of all classes? (a) public (b) private protected 15
16
Question 14 True or False Inheritance is limited to two levels with two classes. True False
17
Question 15 Which of these is possible in C++, but not in Java?
multi-level inheritance multiple inheritance composition inheritance and composition several subclasses inheriting from one superclass
18
Question 16 Animal Mammal Dog Terrier Look at this graphic.
What is this an example of? multi-level inheritance multiple inheritance composition inheritance and composition several subclasses inheriting from one superclass Question 16 Animal Mammal Dog Terrier
19
Question 17 Look at this graphic. What is this an example of?
multi-level inheritance multiple inheritance composition inheritance and composition several subclasses inheriting from one superclass Question 17
20
Question 18 Reptile Extinct Dinosaur Look at this graphic.
What is this an example of? multi-level inheritance multiple inheritance composition inheritance and composition several subclasses inheriting from one superclass Question 18 Reptile Extinct Dinosaur
21
Question 19 Look at this graphic. What is this an example of?
multi-level inheritance multiple inheritance composition inheritance and composition several subclasses inheriting from one superclass Question 19
22
Question 20 Look at this graphic. What is this an example of?
multi-level inheritance multiple inheritance composition inheritance and composition several subclasses inheriting from one superclass Question 20
23
Extra Credit In the Fish class case study, Fish4 inherits from Fish3. Fish3 has a moveFish method. Fish4 also has a moveFish method. What does this mean? (a) The moveFish method of Fish4 is a constructor. The moveFish method of Fish3 is a constructor. (c) Fish4 re-defined the moveFish method. (d) Fish4 is a superclass of Fish3 (e) Fish4 cannot compile.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.