Exam 10: Object-Oriented Programming, Part 3: Inheritance, Polymorphism, and Interfaces

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Why does Java provide a protected access modifier?

Free
(Multiple Choice)
4.7/5
(28)
Correct Answer:
Verified

D

An interface can contain one or more abstract methods.

Free
(True/False)
4.9/5
(39)
Correct Answer:
Verified

True

Assuming that class B inherits from class A and method foo belongs to class A, what do we mean by overriding method foo in class B?

Free
(Multiple Choice)
4.8/5
(46)
Correct Answer:
Verified

C

Abstract methods can be static.

(True/False)
4.9/5
(30)

When is it determined which method is called when using polymorphism?

(Multiple Choice)
4.8/5
(37)

An abstract method:

(Multiple Choice)
4.9/5
(42)

Typically, an abstract class is a class that is not completely implemented.

(True/False)
4.7/5
(45)

What keyword do we use in the class header that inherits from an interface?

(Multiple Choice)
4.7/5
(30)

To use polymorphism, the classes must be in a different hierarchy.

(True/False)
4.8/5
(38)

Inheritance is useful for which of the following?

(Multiple Choice)
4.8/5
(32)

Overriding a method and overloading a method mean the same thing.

(True/False)
4.9/5
(43)

The following code will run without errors: // Figure is an abstract class Figure f = new Figure( );

(True/False)
4.8/5
(37)

An abstract class is declared to be abstract by including the __________ keyword in the class header.

(Short Answer)
4.8/5
(35)

A class can implement more than one interface.

(True/False)
4.9/5
(41)

_________ allows us to use the same method call for any object in a class hierarchy.

(Short Answer)
4.9/5
(33)

You have written a SavingsAccount class based on the BankAccount class in the textbook. You wish to instantiate a SavingsAccount object with a starting balance of $2,175.25. Theorize why you would need to provide an overloaded constructor for the SavingsAccount class.

(Essay)
5.0/5
(33)

Public fields and methods are inherited.

(True/False)
4.9/5
(38)

The extends keyword specifies that the subclass inherits members of the superclass.

(True/False)
4.8/5
(39)

The interface concept is Java's way of implementing __________ inheritance.

(Short Answer)
4.7/5
(37)

When a class extends another class, the default constructor of the subclass automatically calls the default constructor of the superclass. This is called explicit invocation.

(True/False)
4.7/5
(33)
Showing 1 - 20 of 61
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)