Filters
Question type

Study Flashcards

When a class does not use the extends key word to inherit from another class, Java automatically extends it from the __________ class.


A) Object
B) subclass
C) superclass
D) public

E) A) and C)
F) B) and C)

Correct Answer

verifed

verified

In an inheritance relationship, the subclass constructor always executes before the superclass constructor.

A) True
B) False

Correct Answer

verifed

verified

When a class implements an interface, an inheritance relationship known as __________ inheritance is established.


A) implemented
B) interface
C) realized
D) abstract

E) C) and D)
F) A) and B)

Correct Answer

verifed

verified

If you don't provide an access specifier for a class member, the class member is given __________ access by default.


A) private
B) public
C) protected
D) package

E) B) and D)
F) A) and B)

Correct Answer

verifed

verified

D

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


A) UML diagram
B) CRC card
C) flowchart
D) class hierarchy

E) B) and C)
F) A) and B)

Correct Answer

verifed

verified

If a subclass constructor does not explicitly call a superclass constructor,


A) the superclass's fields will be set to the default values for their data types
B) Java will automatically call the superclass's default constructor immediately after the code in the subclass's constructor executes
C) it must include the code necessary to initialize the superclass fields
D) Java will automatically call the superclass's default constructor just before the code in the subclass's constructor executes

E) A) and B)
F) All of the above

Correct Answer

verifed

verified

All fields declared in an interface


A) have protected access
B) must be initialized in the class implementing the interface
C) have private access
D) are treated as final and static

E) B) and D)
F) A) and D)

Correct Answer

verifed

verified

Because every class directly or indirectly inherits from the Object class, every class inherits the Object class's members.

A) True
B) False

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

True

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


A) inherits
B) overloads
C) overrides
D) implements

E) All of the above
F) A) and B)

Correct Answer

verifed

verified

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


A) +
B) -
C) *
D) #

E) A) and D)
F) B) and C)

Correct Answer

verifed

verified

You can write a super statement that calls a superclass constructor but only in the subclass's constructor.

A) True
B) False

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

E) B) and C)
F) All of the above

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

E) A) and B)
F) All of the above

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) both ClassB and ClassC are subclasses

E) A) and B)
F) None of the above

Correct Answer

verifed

verified

You show inheritance in a UML diagram by connecting two classes with a line that has an open arrowhead pointing to the subclass.

A) True
B) False

Correct Answer

verifed

verified

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


A) package
B) protected
C) static
D) final

E) A) and B)
F) None of the above

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

E) C) and D)
F) B) and D)

Correct Answer

verifed

verified

B

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

E) All of the above
F) A) and B)

Correct Answer

verifed

verified

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


A) ClassA
B) ClassB
C) ClassC
D) all are interfaces

E) None of the above
F) A) and D)

Correct Answer

verifed

verified

Showing 1 - 20 of 40

Related Exams

Show Answer