Exam 10: Inheritance

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

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

(True/False)
4.7/5
(41)

A __________ member's access is somewhere between public and private.

(Multiple Choice)
4.8/5
(35)

When a subclass overrides a superclass method, only the subclass's version of the method can be called with a subclass object.

(True/False)
4.8/5
(40)

In the following code, which line in ClassA has an error? Line 1 public interface MyInterface Line 2 { Line 3 int FIELDA = 55; Line 4 public int methodA(double); Line 5 } Line 6 public class ClassA implements MyInterface Line 7 { Line 8 FIELDA = 60; Line 9 public int methodA(double) { } Line 10 }

(Multiple Choice)
4.8/5
(34)

In the following code, what is missing from ClassA? Line 1 public interface MyInterface Line 2 { Line 3 int FIELDA = 55; Line 4 public int methodA(double); Line 5 } Line 6 public class ClassA implements MyInterface Line 7 { Line 8 FIELDA = 60; Line 9 public int methodB(double) { } Line 10 }

(Multiple Choice)
4.9/5
(33)

Which of the following is true about protected access?

(Multiple Choice)
4.9/5
(29)

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

(True/False)
4.9/5
(39)

All fields declared in an interface __________.

(Multiple Choice)
4.8/5
(38)

In the following statement, which is the superclass? public class ClassA extends ClassB implements ClassC

(Multiple Choice)
4.8/5
(32)

Which of the following shows the inheritance relationships among classes in a manner similar to that of a family tree?

(Multiple Choice)
4.8/5
(35)

Protected class members can be denoted in a UML diagram with the __________ symbol.

(Multiple Choice)
4.9/5
(38)

If a class contains an abstract method __________.

(Multiple Choice)
4.9/5
(28)

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

(Multiple Choice)
4.7/5
(40)

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.8/5
(39)

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

(Multiple Choice)
4.9/5
(40)

The __________ key word is used to call a superclass constructor explicitly.

(Multiple Choice)
4.7/5
(38)

When declaring class data members it is best to declare them as __________.

(Multiple Choice)
5.0/5
(37)

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

(Multiple Choice)
4.9/5
(40)

In an inheritance relationship __________.

(Multiple Choice)
4.9/5
(38)

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

(True/False)
4.9/5
(36)
Showing 41 - 60 of 64
close modal

Filters

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