Filters
Question type

Study Flashcards

When you create a class by making it inherit from another class, you are provided with data fields and ____ automatically.


A) fonts
B) methods
C) class names
D) arrays

Correct Answer

verifed

verified

You would like to make a member of a class visible in all subclasses regardless of what package they are in. Which one of the following keywords would achieve this?


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

Correct Answer

verifed

verified

____ is the principle that allows you to apply your knowledge of a general category to more specific objects.


A) Inheritance
B) Polymorphism
C) Encapsulation
D) Override

Correct Answer

verifed

verified

class InstanceofDemo { public static void main(String[] args) { Parent object1 = new Parent(); Parent object2 = new Child(); System.out.println("object1 instanceof Parent: " + (obj1 instanceof Parent)); System.out.println("object1 instanceof Child: " + (obj1 instanceof Child)); System.out.println("object1 instanceof MyInterface: " + (obj1 instanceof MyInterface)); System.out.println("object2 instanceof Parent: " + (obj2 instanceof Parent)); System.out.println("object2 instanceof Child: " + (obj2 instanceof Child)); System.out.println("object2 instanceof MyInterface: " + (obj2 instanceof MyInterface)); } } The above code defines a parent class (named Parent), a simple interface (named MyInterface), and a child class (named Child) that inherits from the parent and implements the interface. Following program execution, what will be the output of the six println statements?

Correct Answer

verifed

verified

Section 1 identifies the three fields of...

View Answer

Within a subclass, you can think of the keyword ____ as the opposite of super.


A) sub
B) this
C) protected
D) not

Correct Answer

verifed

verified

Using a class named Student, write the statement to create a yearOne object of the Student class.

Correct Answer

verifed

verified

The Cylinder class inherits the radius a...

View Answer

What are virtual method calls?

Correct Answer

verifed

verified

In Java, all instance method calls are v...

View Answer

Conventionally, arrows used in a ____ to show inheritance relationships extend from the descendant class and point to the one from which it descends.


A) method diagram
B) UML diagram
C) virtual method call
D) composition

Correct Answer

verifed

verified

What does polymorphism mean in Java programming?

Correct Answer

verifed

verified

Using the same method name to indicate d...

View Answer

The ability to use inheritance in Java makes programs easier to write, ____, and more quickly understood.


A) faster
B) more secure
C) more robust
D) less error prone

Correct Answer

verifed

verified

You can use the ____ modifier with methods when you don't want the method to be overridden.


A) override
B) access
C) final
D) end

Correct Answer

verifed

verified

The methods in a subclass can use all of the data fields and methods that belong to its parent, with one exception: ____ members of the parent class are not accessible within a child class's methods.


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

Correct Answer

verifed

verified

How is the keyword protected used?

Correct Answer

verifed

verified

Using the keyword protected provides you...

View Answer

Which statement correctly declares a sedan object of the Car class?


A) sedan Car = new sedan() ;
B) sedan Car = new sedan() ;
C) Car sedan = new Car() ;
D) new sedan() = Student;

Correct Answer

verifed

verified

The term ____________________ means "many forms."

Correct Answer

verifed

verified

Match each term with the correct statement below. -Makes a program run faster


A) information hiding
B) inheritance
C) super()
D) superclass
E) instanceof
F) virtual method call
G) inlining
H) class diagram
I) derived class

Correct Answer

verifed

verified

If jrStudent is an object of Student, which of the following statements will result in a value of true?


A) Student = instanceof jrStudent
B) jrStudent instanceof Student
C) instanceof Student = jrStudent
D) Student instanceof jrStudent

Correct Answer

verifed

verified

A class diagram consists of a rectangle divided into three sections.

Correct Answer

verifed

verified

In most Java classes, the keyword private precedes each data field, and the keyword ____________________ precedes each method.

Correct Answer

verifed

verified

What is the process of inlining and how is it accomplished in Java?

Correct Answer

verifed

verified

Because a final method's definition can ...

View Answer

Showing 41 - 60 of 70

Related Exams

Show Answer