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

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

Which of the options listed will happen if the following code segment is run, assuming the remainder of the program is coded correctly? 10 public class Circle extends Figure 11 { 12 private int radius; 13 public Circle( ) 14 { 15 super( ); 16 radius = 0;

(Multiple Choice)
4.8/5
(32)

Private fields and methods are part of the inheriting class object.

(True/False)
4.9/5
(32)

If the call to the direct superclass constructor was not the first statement in the constructor, a compiler error will be generated.

(True/False)
4.9/5
(40)

Usually, an abstract class contains at least one abstract method.

(True/False)
4.7/5
(50)

Protected fields and methods are inherited.

(True/False)
4.9/5
(36)

Which Java keyword do we use in the constructor of a class inheriting from another class if we want to call the constructor of the inherited class?

(Multiple Choice)
5.0/5
(37)

When class B inherits from class A:

(Multiple Choice)
4.9/5
(40)

Which of the following cannot be an interface member?

(Multiple Choice)
4.8/5
(43)

If a class has an abstract method, then that class must be declared abstract.

(True/False)
4.8/5
(31)

Some OOP developers call a subclass the base class and call a superclass the derived class.

(True/False)
4.8/5
(40)

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

(True/False)
4.9/5
(41)

Which of the following is true of polymorphism?

(Multiple Choice)
4.8/5
(39)

A method in a subclass overriding a method in a superclass cannot call the superclass method.

(True/False)
4.7/5
(32)

Which of the following are not inherited by subclasses?

(Multiple Choice)
4.8/5
(50)

Abstract methods can be overridden.

(True/False)
4.9/5
(31)

An interface can contain one or more static constants.

(True/False)
4.8/5
(45)

The extends keyword specifies that the subclass inherits members of the superclass, so:

(Multiple Choice)
4.8/5
(45)

Several classes implement an interface, but all of them implement the same method using the same code. To provide a common method for all of these classes, you would create an abstract class.

(True/False)
4.9/5
(30)

Suppose you write a program in which you attempt to use a subclass to directly access a private password field in a superclass. Predict what will happen, and suggest a solution that would result in a different outcome.

(Essay)
4.9/5
(39)

Inheritance helps organize related classes into __________.

(Short Answer)
4.9/5
(38)
Showing 21 - 40 of 61
close modal

Filters

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