Filters
Question type

Study Flashcards

What is required for an interface method that has a body?


A) The method header must begin with the key word default.
B) A class that implements the interface must override the method.
C) The @Default annotation must precede the method header.
D) All of these are true.

Correct Answer

verifed

verified

In __________, inheritance is shown with a line that has an open arrowhead at one end that points to the superclass.


A) pseudocode
B) a UML diagram
C) a CRC card
D) a hierarchy chart

Correct Answer

verifed

verified

A subclass can directly access __________.


A) only protected and private members of the superclass
B) all members of the superclass
C) only public and private members of the superclass
D) only public and protected members of the superclass

Correct Answer

verifed

verified

Given the following code, which statement is true? public class ClassB implements ClassA{ }


A) ClassA must override each method in ClassB.
B) ClassB must override each method in ClassA.
C) ClassB inherits from ClassA.
D) ClassA inherits from ClassB.

Correct Answer

verifed

verified

When a subclass overloads a superclass method __________.


A) both methods may be called with a subclass object
B) only the subclass method may be called with a subclass object
C) only the superclass method may be called with a subclass object
D) neither method may be called with a subclass object

Correct Answer

verifed

verified

__________ is a special type of expression used to create an object that implements a functional interface.


A) lambda
B) beta
C) alpha
D) sigma

Correct Answer

verifed

verified

In a class hierarchy __________.


A) the more general classes are toward the right of the tree and the more specialized classes are toward the left
B) the more general classes are toward the top of the tree and the more specialized classes are toward the bottom
C) the more general classes are toward the left of the tree and the more specialized classes are toward the right
D) the more general classes are toward the bottom of the tree and the more specialized classes are toward the top

Correct Answer

verifed

verified

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


A) ClassA
B) ClassB
C) ClassC
D) cannot tell

Correct Answer

verifed

verified

Which of the following is the operator used to determine whether an object is an instance of a particular class?


A) equals
B) instanceOf
C) >>
D) isa

Correct Answer

verifed

verified

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.") ; } }


A) This cannot be determined from the code.
B) It will call the method super and pass the value 40 to it as an argument.
C) It will call the constructor of ClassA that receives an integer as an argument.
D) The method super will have to be defined before we can say what will happen.

Correct Answer

verifed

verified

C

When a method is declared with the __________ modifier, it cannot be overridden in a subclass.


A) final
B) super
C) void
D) public

Correct Answer

verifed

verified

A class becomes abstract when you place the __________ key word in the class definition.


A) super
B) extends
C) final
D) abstract

Correct Answer

verifed

verified

If ClassC is derived from ClassB which is derived from ClassA, this would be an example of


A) a chain of inheritance
B) linear inheritance
C) multiple interfaces
D) cascading classes

Correct Answer

verifed

verified

Inheritance involves a subclass, which is the general class, and a superclass, which is the specialized class.

Correct Answer

verifed

verified

When an "is a" relationship exists between objects, the specialized object has __________.


A) some of the characteristics of the general class, but not all, plus additional characteristics
B) some, but not all, of the characteristics of the general object
C) none of the characteristics of the general object
D) all of the characteristics of the general object plus additional characteristics

Correct Answer

verifed

verified

All methods in an abstract class must also be declared abstract.

Correct Answer

verifed

verified

False

A functional interface is simply an interface that has one abstract method.

Correct Answer

verifed

verified

A protected member of a class may be directly accessed by __________.


A) methods of the same class
B) methods of a subclass
C) methods in the same package
D) Any of these

Correct Answer

verifed

verified

Because the subclass is more specialized than the superclass, it is sometimes necessary for the subclass to replace inadequate superclass methods with more suitable ones.

Correct Answer

verifed

verified

What type of relationship exists between two objects when one object is a specialized version of another object?


A) "is a"
B) "contains a"
C) "has a"
D) "consists of"

Correct Answer

verifed

verified

A

Showing 1 - 20 of 64

Related Exams

Show Answer