PreAP Computer Science Quiz Key

Slides:



Advertisements
Similar presentations
School of Computer Science & Information Technology G6DICP - Lecture 16 Inheritance.
Advertisements

PreAP Computer Science Quiz
AP Computer Science DYRT Quiz Key
Week 8 Recap CSE 115 Spring Composite Revisited Once we create a composite object, it can itself refer to composites. Once we create a composite.
Objectives Introduction to Inheritance and Composition (Subclasses and SuperClasses) Overriding (and extending), and inheriting methods and constructors.
1 Composition A whole-part relationship (e.g. Dog-Tail) Whole and part objects have same lifetime –Whole creates instance of part in its constructor In.
Inheritance COMP53 Sept Inheritance Inheritance allows us to define new classes by extending existing classes. A child class inherits all members.
UML Class Diagram: class Rectangle
Chapter 10: Inheritance and Polymorphism
8.1 Classes & Inheritance Inheritance Objects are created to model ‘things’ Sometimes, ‘things’ may be different, but still have many attributes.
Fall 2005CSE 115/503 Introduction to Computer Science I1 Composition details Recall, composition involves 3 things: –Declaration of instance variable of.
PreAP Computer Science Quiz
Inheritance Inheritance is the process of using features (both attributes and methods) from an existing class. The existing class is called the superclass.
PreAP Computer Science Quiz
(C) 2010 Pearson Education, Inc. All rights reserved. Java™ How to Program, 8/e.
PreAP Computer Science Quiz
Chapter 11 Inheritance and Composition. Chapter Objectives Learn about inheritance Learn about subclasses and superclasses Explore how to override the.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
Specialization and Inheritance Chapter 8. 8 Specialization Specialized classes inherit the properties and methods of the parent or base class. A dog is.
PreAP Computer Science Quiz
Inheritance, Abstract & Interface Pepper With help from and
Computer Science Reading Quiz 6.2 (Sections )
Inheritance Inheritance is the process of using features (both attributes and methods) from an existing class. The existing class is called the superclass.
Chris Kiekintveld CS 2401 (Fall 2010) Elementary Data Structures and Algorithms Inheritance and Polymorphism.
PreAP Computer Science Review Quiz 08 Key
RIT Computer Science Dept. Goals l Inheritance l Modifiers: private, public, protected l Polymorphism.
PreAP Computer Science Quiz Key
Inheritance Inheritance is the process of using features (both attributes and methods) from an existing class. The existing class is called the superclass.
Object Oriented Programming (OOP) is a style of programming that incorporates these 3 features: Encapsulation Polymorphism Class Interaction.
Inheritance and Access Control CS 162 (Summer 2009)
Inheritance Objectives: Creating new classes from existing classes The protected modifier Creating class hierarchies Abstract classes Indirect visibility.
PreAP Computer Science Quiz
Take out a piece of paper and PEN. The quiz starts ONE minute after the tardy bell rings. You will have 45 – 90 seconds per question. Determine the output.
PreAP Computer Science Quiz
Exposure Java 2011 APCS Edition
Java Programming: From Problem Analysis to Program Design, 3e Chapter 11 Inheritance and Polymorphism.
AP Computer Science DYRT Quiz
Take out a piece of paper and PEN.
Inheritance and Polymorphism. Superclass and Subclass Inheritance defines a relationship between objects that share characteristics. It is a mechanism.
PreAP Computer Science Quiz
Take out a piece of paper and PEN.
Inheritance and Polymorphism
PreAP Computer Science Quiz Take out a piece of paper and PEN. The quiz starts ONE minute after the tardy bell rings. You will have 30 – 60 seconds.
AP Computer Science DYRT Quiz
Java Programming Fifth Edition Chapter 9 Introduction to Inheritance.
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. Exposure Java 2014 for.
Objects as a programming concept
Interface, Subclass, and Abstract Class Review
One class is an extension of another.
Chapter 11: Inheritance and Polymorphism
UML Class Diagram: class Rectangle
Pre-AP® Computer Science Quiz Key
Pre-AP® Computer Science Quiz
Section 9.1 Introduction.
Java Programming, Second Edition
Take out a piece of paper and PEN.
PreAP Computer Science Review Quiz 08
PreAP Computer Science Quiz Key
Take out a piece of paper and PEN.
Inheritance and Polymorphism
PreAP Computer Science Quiz
Take out a piece of paper and PEN.
Take out a piece of paper and PEN.
Take out a piece of paper and PEN.
Assessment – Java Basics: Part 2
AP Computer Science DYRT Quiz
Take out a piece of paper and PEN.
មជ្ឈមណ្ឌលកូរ៉េ សហ្វវែរ អេច អ ឌី
Inheritance Lakshmish Ramaswamy.
Pre-AP® Computer Science Quiz
Presentation transcript:

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.

Title the quiz as shown below The quiz starts in ONE minute. Name Period Date Quiz 09.01-06 1. 11. 2. 12. 3. 13. 4. 14. 5. 15. 6. 16. 7. 17. 8. 18. 9. 19. 10. 20. EC.

Question 01 Inheritance describes what type of relationship? “is-a” “has-a”

Question 02 Composition describes what type of relationship? “is-a” “has-a”

Question 03 Which of the following shows an example of an inheritance relationship? dog cat house door hanger shelf student person 5

Question 04 Which of the following shows an example of a composition relationship? dog cat house door hanger shelf student person 6

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.

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.

Question 07 Which single Java keyword indicates that inheritance is used? isa hasa extends inherits

Question 08 True or False When an object of a subclass is instantiated, the constructor of the superclass is called first. True (b) False

Question 09 True or False Methods of a subclass have access to the private data of a superclass. True False

Question 10 True or False Methods of a subclass have access to the public data of a superclass. True False

Question 11 True or False Methods of a subclass have access to the protected data of a superclass. True False

Question 12 The Geometry analogy which states that a square is a rectangle is an example of encapsulation. concatenation. inheritance. polymorphism. composition.

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

Question 14 True or False Inheritance is limited to two levels with two classes. True False

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

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

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

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

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

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

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.