AP Computer Science DYRT Quiz 09.01-07 Key

23
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.

description

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. Title the quiz as shown below The quiz starts in ONE minute. Question 01. Question 02. Question 03. - PowerPoint PPT Presentation

Transcript of AP Computer Science DYRT Quiz 09.01-07 Key

Page 1: AP Computer Science DYRT Quiz 09.01-07  Key

AP Computer ScienceDYRT 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.

Page 2: AP Computer Science DYRT Quiz 09.01-07  Key

Title the quiz as shown belowThe quiz starts in ONE minute.

Name Period Date

Quiz 09.01-071. 11.2. 12.3. 13.4. 14.5. 15.6. 16.7. 17.8. 18.9. 19.10. 20.

EC.

Page 3: AP Computer Science DYRT Quiz 09.01-07  Key

Question 01

Inheritance describes what type of relationship?

(a) “is-a”

(b) “has-a”

Page 4: AP Computer Science DYRT Quiz 09.01-07  Key

Question 02

Composition describes what type of relationship?

(a) “is-a”

(b) “has-a”

Page 5: AP Computer Science DYRT Quiz 09.01-07  Key

Question 03

Which of the following shows an example of an inheritance relationship?

(a) dog cat.

(b) house door

(c) hanger closet

(d) student person

Page 6: AP Computer Science DYRT Quiz 09.01-07  Key

Question 04

Which of the following shows an example of a composition relationship?

(a) dog cat.

(b) house door

(c) hanger closet

(d) student person

Page 7: AP Computer Science DYRT Quiz 09.01-07  Key

Question 05

Inheritance involves the use of at least twoclasses. The existing (and more general) class is called the

(a) superclass.(b) default class.(c) overloaded class.(d) subclass.

Page 8: AP Computer Science DYRT Quiz 09.01-07  Key

Question 06

Inheritance involves the use of at least twoclasses. The new and improved class whichuses inheritance is called the

(a) superclass.(b) default class.(c) overloaded class.(d) subclass.

Page 9: AP Computer Science DYRT Quiz 09.01-07  Key

Question 07

Which single Java keyword indicates thatinheritance is used?

(a) isa(b) hasa(c) extends(d) inherits(e) super

Page 10: AP Computer Science DYRT Quiz 09.01-07  Key

Question 08

True or False

When an object of a subclass is instantiated,the constructor of the superclass is called first.

(a) True (b) False

Page 11: AP Computer Science DYRT Quiz 09.01-07  Key

Question 09

True or False

Methods of a subclass have access to private data of a superclass.

(a) True (b) False

Page 12: AP Computer Science DYRT Quiz 09.01-07  Key

Question 10

True or False

Methods of a subclass have access to the protected data of a superclass.

(a) True (b) False

Page 13: AP Computer Science DYRT Quiz 09.01-07  Key

Question 11

The Geometry analogy which states thata square is a rectangle is an example of

(a) encapsulation.(b) concatenation.(c) inheritance.(d) polymorphism.

Page 14: AP Computer Science DYRT Quiz 09.01-07  Key

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

Page 15: AP Computer Science DYRT Quiz 09.01-07  Key

Question 13

True of False

Inheritance is limited to two levels with two classes.

(a) True (b) False

Page 16: AP Computer Science DYRT Quiz 09.01-07  Key

Question 14

Which of these is possible in C++, but not in Java?

(a) multi-level inheritance

(b) multiple inheritance

(c) umbrella classes

(d) composition

Page 17: AP Computer Science DYRT Quiz 09.01-07  Key

Question 15

Animal

Mammal

Dog

Terrier

Look at this graphic. What is this an example of?

(a) multi-level inheritance

(b) multiple inheritance

(c) an umbrella class

(d) composition

Page 18: AP Computer Science DYRT Quiz 09.01-07  Key

Question 16 Look at this graphic. What is this an example of?

(a) multi-level inheritance

(b) multiple inheritance

(c) an umbrella class

(d) composition

Page 19: AP Computer Science DYRT Quiz 09.01-07  Key

Question 17

Reptile

Dinosaur

Extinct

Look at this graphic. What is this an example of?

(a) multi-level inheritance

(b) multiple inheritance

(c) an umbrella class

(d) composition

Page 20: AP Computer Science DYRT Quiz 09.01-07  Key

Question 18 Look at this graphic. What is this an example of?

(a) multi-level inheritance

(b) multiple inheritance

(c) an umbrella class

(d) composition

Page 21: AP Computer Science DYRT Quiz 09.01-07  Key

Question 19

What is the umbrella class in this example?

Animal tiger = new Cat( );Animal eagle = new Bird( );Animal shark = new Fish( );

(a) Animal(b) Bird(c) Cat(d) Fish

Page 22: AP Computer Science DYRT Quiz 09.01-07  Key

Question 20

Can this program code be correct?

Animal tiger = new Cat( );Animal eagle = new Bird( );Animal shark = new Fish( );

(a) No, because the Animal class cannot be used to construct Cat, Bird or Fish objects. (b) No, because Animal is a subclass.(c) Yes, because Animal is a superclass.(d) Yes, because Animal is a subclass.

Page 23: AP Computer Science DYRT Quiz 09.01-07  Key

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