AP Computer Science DYRT Quiz Key

Slides:



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

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.
Chapter 8 Improving Structure with Inheritance. The DoME Example The Database of Multimedia Entertainment We will be storing information about CDs and.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:
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 and Polymorphism Recitation 04/10/2009 CS 180 Department of Computer Science, Purdue University.
UML Class Diagram: class Rectangle
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.
LECTURE 07 Programming using C# Inheritance
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.
Inheritance and Class Hierarchies Ellen Walker CPSC 201 Data Structures Hiram College.
Specialization and Inheritance Chapter 8. 8 Specialization Specialized classes inherit the properties and methods of the parent or base class. A dog is.
What is inheritance? It is the ability to create a new class from an existing class.
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)
1 Abstract Classes and Interfaces. 2 The abstract Modifier  The abstract class –Cannot be instantiated –Should be extended and implemented in subclasses.
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.
Exposure Java 2011 APCS Edition
PreAP Computer Science Quiz Key
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.
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
Geoff Holmes and Bernhard Pfahringer COMP206-08S General Programming 2.
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
Road Map Inheritance Class hierarchy Overriding methods Constructors
UML Class Diagram: class Rectangle
Exposure Java 2013 APCS Edition Chapter 9 Slides Focus on OOP:
Chapter 10 Thinking in Objects
Pre-AP® Computer Science Quiz Key
Pre-AP® Computer Science Quiz
Inherited Classes in Java
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.
AP Computer Science DYRT Quiz
Take out a piece of paper and PEN.
មជ្ឈមណ្ឌលកូរ៉េ សហ្វវែរ អេច អ ឌី
Inheritance Lakshmish Ramaswamy.
Pre-AP® Computer Science Quiz
Presentation transcript:

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. Name Period Date Quiz 09.01-07 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 closet student person 5

Question 04 Which of the following shows an example of a composition relationship? dog cat. house door hanger closet 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 super

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 private data of a superclass. True (b) False

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

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

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

Question 13 True of False Inheritance is limited to two levels with two classes. True (b) False

Question 14 Which of these is possible in C++, but not in Java? (a) multi-level inheritance (b) multiple inheritance umbrella classes composition

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

Question 16 Look at this graphic. What is this an example of? multi-level inheritance multiple inheritance an umbrella class composition Question 16

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

Question 18 Look at this graphic. What is this an example of? multi-level inheritance multiple inheritance an umbrella class composition Question 18

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

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.

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