PreAP Computer Science Quiz

Slides:



Advertisements
Similar presentations
AP Computer Science DYRT Quiz Key
Advertisements

Objectives Introduction to Inheritance and Composition (Subclasses and SuperClasses) Overriding (and extending), and inheriting methods and constructors.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Inheritance COMP53 Sept Inheritance Inheritance allows us to define new classes by extending existing classes. A child class inherits all members.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter N - 1 Chapter 13 Polymorphism is-a relationships Interfaces.
CS 106 Introduction to Computer Science I 11 / 19 / 2007 Instructor: Michael Eckmann.
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.
© 2006 Pearson Addison-Wesley. All rights reserved9 A-1 Chapter 9 Advanced Java Topics CS102 Sections 51 and 52 Marc Smith and Jim Ten Eyck Spring 2007.
Inheritance Inheritance is the process of using features (both attributes and methods) from an existing class. The existing class is called the superclass.
LECTURE 07 Programming using C# Inheritance
PreAP Computer Science Quiz
Sadegh Aliakbary Sharif University of Technology Fall 2010.
(C) 2010 Pearson Education, Inc. All rights reserved. Java™ How to Program, 8/e.
Chapter 11 Inheritance and Composition. Chapter Objectives Learn about inheritance Learn about subclasses and superclasses Explore how to override the.
Inheritance and Class Hierarchies Ellen Walker CPSC 201 Data Structures Hiram College.
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
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.
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)
Sadegh Aliakbary Sharif University of Technology Fall 2010.
Object Oriented Programming
1 COSC2007 Data Structures II Chapter 9 Class Relationships.
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.
Encapsulation, Inheritance, Composition. Class Methods Can be either void or return Can have parameters or not Must be static Should be public Know how.
Exposure Java 2011 APCS Edition
Java Programming: From Problem Analysis to Program Design, 3e Chapter 11 Inheritance and Polymorphism.
PreAP Computer Science Quiz Key
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
© 2007 Lawrenceville Press Slide 1 Chapter 9 Inheritance  One class is an extension of another.  Allows a class to define a specialized type of an existing.
Inheritance and Class Hierarchies Chapter 3. Chapter Objectives  To understand inheritance and how it facilitates code reuse  To understand how Java.
Inheritance and Polymorphism. Superclass and Subclass Inheritance defines a relationship between objects that share characteristics. It is a mechanism.
PreAP Computer Science Quiz
Inheritance Chapter 11 in Gaddis. Is a relationships in ‘real’ life Exist when one object is a specialized version of another one –Examples An english.
1 Inheritance One of the goals of object oriented programming is code reuse. Inheritance is one mechanism for accomplishing code reuse. It allows us to.
Geoff Holmes and Bernhard Pfahringer COMP206-08S General Programming 2.
Java Programming: Guided Learning with Early Objects Chapter 9 Inheritance and Polymorphism.
Java Programming Fifth Edition Chapter 9 Introduction to Inheritance.
Modern Programming Tools And Techniques-I
Objects as a programming concept
Interface, Subclass, and Abstract Class Review
Week 4 Object-Oriented Programming (1): Inheritance
UML Class Diagram: class Rectangle
Chapter 10 Thinking in Objects
MSIS 670 Object-Oriented Software Engineering
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
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.
មជ្ឈមណ្ឌលកូរ៉េ សហ្វវែរ អេច អ ឌី
Pre-AP® Computer Science Quiz
Presentation transcript:

PreAP Computer Science Quiz 09.01- 06 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.