Filters
Question type

Study Flashcards

Declaring a method final means:


A) it will prepare the object for garbage collection.
B) it cannot be accessed from outside its class.
C) it cannot be overloaded.
D) it cannot be overridden.

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

Correct Answer

verifed

verified

Non-abstract classes are called ________.


A) real classes.
B) instance classes.
C) implementable classes.
D) concrete classes.

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

Correct Answer

verifed

verified

Which of the following statements is false?


A) An advantage of inheritance over interfaces is that only inheritance provides the is-a relationship.
B) Objects of any subclass of a class that implements an interface can also be thought of as objects of that interface type.
C) When a method parameter is declared with a subclass or interface type,the method processes the object passed as an argument polymorphically.
D) All objects have the methods of class Object.

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

Correct Answer

verifed

verified

Classes and methods are declared final for all but the following reasons:


A) final methods allow inlining the code.
B) final methods and classes prevent further inheritance.
C) final methods are static.
D) final methods can improve performance.

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

Correct Answer

verifed

verified

It is a UML convention to denote the name of an abstract class in ________.


A) bold.
B) italics.
C) a diamond.
D) there is no convention of the UML to denote abstract classes-they are listed just as any other class.

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

Correct Answer

verifed

verified

Which of the following could be used to declare abstract method method1 in abstract class Class1 (method1 returns an int and takes no arguments) ?


A) public int method1() ;
B) public int abstract method1() ;
C) public abstract int method1() ;
D) public int nonfinal method1() ;

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

Correct Answer

verifed

verified

Polymorphism enables you to:


A) program in the general.
B) program in the specific.
C) absorb attributes and behavior from previous classes.
D) hide information from the user.

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

Correct Answer

verifed

verified

Which keyword is used to specify that a class will define the methods of an interface?


A) uses
B) implements
C) defines
D) extends

E) None of the above
F) All of the above

Correct Answer

verifed

verified

Showing 21 - 28 of 28

Related Exams

Show Answer