Inheritance Quiz

Inheritance Quiz

University

5 Qs

quiz-placeholder

Similar activities

REVIEW 3.3

REVIEW 3.3

1st Grade - University

6 Qs

OOP Quiz 5

OOP Quiz 5

University

10 Qs

CALL TOEFL Exercise 4-6

CALL TOEFL Exercise 4-6

University

10 Qs

The Last Dog       Were you paying attention?

The Last Dog Were you paying attention?

3rd Grade - Professional Development

10 Qs

EVENT HANDLING

EVENT HANDLING

University

10 Qs

Definite and indefinite article

Definite and indefinite article

University

10 Qs

Adjectives

Adjectives

University - Professional Development

10 Qs

PASSIVE VOICE

PASSIVE VOICE

University

9 Qs

Inheritance Quiz

Inheritance Quiz

Assessment

Quiz

Education

University

Medium

Created by

Rose Malaborbor

Used 1+ times

FREE Resource

5 questions

Show all answers

1.

MULTIPLE SELECT QUESTION

1 min • 3 pts

Which of the following statements about inheritance in Java is/are true?

Inheritance allows a subclass to inherit fields and methods from its superclass.

Java supports multiple inheritance.

The keyword "extends" is used to indicate that a class is a subclass of another class.

Constructors are not inherited from the superclass.

2.

MULTIPLE CHOICE QUESTION

1 min • 3 pts

A car dealership needs a program to store information about the cars for sale. For each car, they want to keep track of the following information: number of doors (2 or 4), whether the car has air conditioning, and its average number of miles per gallon. Which of the following is the best design?

Use four unrelated classes: Car, Doors, AirConditioning, and MilesPerGallon.

Use classes: Doors, AirConditioning, and MilesPerGallon, each with a subclass Car.

Use a class Car, with fields: numDoors, hasAir, and milesPerGallon.

Use a class Car, with superclasses of Doors, AirConditioning, and MilesPerGallon.

3.

MULTIPLE CHOICE QUESTION

3 mins • 3 pts

A bookstore is working on an on-line ordering system. For each type of published material (books, movies, audio tapes) they need to track the id, title, author(s), date published, and price. Which of the following would be the best design?

Create one class PublishedMaterial with the requested fields plus type.

Create classes Book, Movie, and AudioTape with the requested fields.

Create one class BookStore with the requested fields plus type.

Create the class PublishedMaterial with child classes of Book, Movie, and AudioTape.

4.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

In a Multi-Level Inheritance in Java, the last subclass inherits methods and properties of ____.

Only one immediate Superclass

Few classes above it.

All classes above it

None of the choices

5.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

Which of the following is an example of hierarchical inheritance in Java?

A Car class that inherits from a Vehicle class, and a Truck class that inherits from the Car class.

A Circle class that inherits from a Shape class, and a Shape class that inherits from the Rectangle class.

A Person class that inherits from a Student class, and a Teacher class that inherits from the Person class.

A Dog class that inherits from an Animal class, and a Cat class that also inherits from the Animal class.