Exam 10: Inheritance

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

When one object is a specialized version of another object, there is this type of relationship between them.

Free
(Multiple Choice)
4.9/5
(43)
Correct Answer:
Verified

B

In UML diagrams, inheritance is shown:

Free
(Multiple Choice)
4.9/5
(36)
Correct Answer:
Verified

A

It is not possible for a superclass to call a subclass's method.

Free
(True/False)
4.8/5
(42)
Correct Answer:
Verified

True

In the following code, what will the call to super do? Public class ClassB extends ClassA { Public ClassB() { Super(40); System.out.println("This is the last statement "+ "in the constructor."); } }

(Multiple Choice)
4.8/5
(44)

In an inheritance relationship:

(Multiple Choice)
4.8/5
(40)

Private members of the superclass cannot be accessed by the subclass.

(True/False)
4.8/5
(30)

If two methods in the same class have the same name but different signatures, the second overrides the first.

(True/False)
4.8/5
(42)

Replacing inadequate superclass methods with more suitable subclass methods is known as what?

(Multiple Choice)
4.8/5
(32)

Protected class members are denoted in a UML diagram with the symbol

(Multiple Choice)
4.9/5
(42)

Every class is either directly or indirectly derived from the Object class.

(True/False)
4.9/5
(36)

A subclass can directly access:

(Multiple Choice)
4.9/5
(34)

This annotation tells the Java compiler that a method is meant to override a method in the superclass.

(Multiple Choice)
4.9/5
(35)

An abstract class is not instantiated, but serves as a superclass for other classes.

(True/False)
5.0/5
(30)

If a method in a subclass has the same signature as a method in the superclass, the subclass method overloads the superclass method.

(True/False)
4.8/5
(36)

When a subclass overloads a superclass method:

(Multiple Choice)
4.8/5
(43)

A compiler error will result if an anonymous inner class tries to use a variable that is not final, or not effectively final.

(True/False)
4.9/5
(36)

Look at the following code. The method in line ________ will override the method in line ________. Line 1 public class ClassA Line 2 { Line 3 public ClassA() {} Line 4 public int method1(int a){} Line 5 public double method2(int b){} Line 6 } Line 7 public ClassB extends ClassA Line 8 { Line 9 public ClassB(){} Line 10 public int method1(int b, int c){} Line 11 public double method2(double c){} Line 12 }

(Multiple Choice)
4.8/5
(44)

A protected member of a class may be directly accessed by:

(Multiple Choice)
4.8/5
(41)

Look at the following code and determine what the call to super will do. public class ClassB extends ClassA { Public ClassB() { Super(10); } }

(Multiple Choice)
4.7/5
(39)

What is wrong with the following code? Public class ClassB extends ClassA { Public ClassB() { Int init = 10; Super(40); } }

(Multiple Choice)
4.7/5
(39)
Showing 1 - 20 of 70
close modal

Filters

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