Download presentation
1
AP Computer Science DYRT Quiz 09.01-07 Key
Take out a piece of paper and PEN. The quiz starts TWO minutes after the tardy bell rings. You will have 30 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 closet student person 5
6
Question 04 Which of the following shows an example of a composition relationship? dog cat. house door hanger closet 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 super
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
private data of a superclass. True (b) False
12
Question 10 True or False Methods of a subclass have access to the
protected data of a superclass. True False
13
Question 11 The Geometry analogy which states that
a square is a rectangle is an example of encapsulation. concatenation. inheritance. polymorphism.
14
Question 12 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 (c) protected 14
15
Question 13 True of False Inheritance is limited to two levels with two classes. True (b) False
16
Question 14 Which of these is possible in C++, but not in Java?
(a) multi-level inheritance (b) multiple inheritance umbrella classes composition
17
Question 15 Animal Mammal Dog Terrier Look at this graphic.
What is this an example of? multi-level inheritance multiple inheritance an umbrella class composition Question 15 Animal Mammal Dog Terrier
18
Question 16 Look at this graphic. What is this an example of?
multi-level inheritance multiple inheritance an umbrella class composition Question 16
19
Question 17 Reptile Extinct Dinosaur Look at this graphic.
What is this an example of? multi-level inheritance multiple inheritance an umbrella class composition Question 17 Reptile Extinct Dinosaur
20
Question 18 Look at this graphic. What is this an example of?
multi-level inheritance multiple inheritance an umbrella class composition Question 18
21
Question 19 What is the umbrella class in this example?
Animal tiger = new Cat( ); Animal eagle = new Bird( ); Animal shark = new Fish( ); Animal Bird Cat Fish
22
Question 20 Can this program code be correct?
Animal tiger = new Cat( ); Animal eagle = new Bird( ); Animal shark = new Fish( ); No, because the Animal class cannot be used to construct Cat, Bird or Fish objects. No, because Animal is a subclass. Yes, because Animal is a superclass. Yes, because Animal is a subclass.
23
Extra Credit If the super class constructor requires one or more parameters, what command must be the very first command of the subclass constructor? (a) isa (d) hasa (b) extends (e) inherits (c) sub (f) super
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.