Filters
Question type

Study Flashcards

The UML distinguishes an interface from other classes by placing the word "interface" in above the interface name.


A) italics.
B) carets.
C) guillemets.
D) bold.

Correct Answer

verifed

verified

Assigning a subclass reference to a superclass variable is safe:


A) because the subclass object has an object of its superclass.
B) because the subclass object is an object of its superclass.
C) only when the superclass is abstract.
D) only when the superclass is concrete.

Correct Answer

verifed

verified

class cannot be instantiated.


A) final.
B) concrete.
C) abstract.
D) polymorphic.

Correct Answer

verifed

verified

C

When a superclass variable refers to a subclass object and a method is called on that object,the proper implementation is determined at execution time.What is the process of determining the correct method to call?


A) early binding.
B) non-binding.
C) on-time binding.
D) late binding.

Correct Answer

verifed

verified

Which of the following is not possible?


A) A class that implements two interfaces.
B) A class that inherits from two classes.
C) A class that inherits from one class,and implements an interface.
D) All of the above are possible.

Correct Answer

verifed

verified

Interfaces can have methods.


A) 0
B) 1
C) 2
D) any number of

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.

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.

Correct Answer

verifed

verified

A class that implements an interface but does not declare all of the interface's methods must be declared:


A) public.
B) interface.
C) abstract.
D) final.

Correct Answer

verifed

verified

Polymorphism allows for specifics to be dealt with during:


A) execution.
B) compilation.
C) programming.
D) debugging.

Correct Answer

verifed

verified

Non-abstract classes are called:


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

Correct Answer

verifed

verified

D

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.

Correct Answer

verifed

verified

Every object in Java knows its own class and can access this information through method .


A) getClass.
B) getInformation.
C) objectClass.
D) objectInformation.

Correct Answer

verifed

verified

A

Which of the following does not complete the sentence correctly? An interface .


A) forces classes that implement it to declare all the interface methods.
B) can be used in place of an abstract class when there is no default implementation to inherit.
C) is declared in a file by itself and is saved in a file with the same name as the interface followed by the .java extension.
D) can be instantiated.

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.

Correct Answer

verifed

verified

Which of the following statements about abstract superclasses is true?


A) abstract superclasses may contain data.
B) abstract superclasses may not contain implementations of methods.
C) abstract superclasses must declare all methods as abstract.
D) abstract superclasses must declare all data members not given values as abstract.

Correct Answer

verifed

verified

Which statement best describes the relationship between superclass and subclass types?


A) A subclass reference cannot be assigned to a superclass variable and a superclass reference cannot be assigned to a subclass variable.
B) A subclass reference can be assigned to a superclass variable and a superclass reference can be assigned to a subclass variable.
C) A superclass reference can be assigned to a subclass variable,but a subclass reference cannot be assigned to a superclass variable.
D) A subclass reference can be assigned to a superclass variable,but a superclass reference cannot be assigned to a subclass variable.

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() ;

Correct Answer

verifed

verified

Consider classes A,B and C,where A is an abstract superclass,B is a concrete class that inherits from A and C is a concrete class that inherits from B.Class A declares abstract method originalMethod,implemented in class B.Which of the following statements is true of class C?


A) Method originalMethod cannot be overridden in class C-once it has been implemented in concrete class B,it is implicitly final.
B) Method originalMethod must be overridden in class C,or a syntax error will occur.
C) If method originalMethod is not overridden in class C but is called by an object of class C,an error occurs.
D) None of the above.

Correct Answer

verifed

verified

All of the following methods are implicitly final except:


A) a method in an abstract class.
B) a private method.
C) a method declared in a final class.
D) static method.

Correct Answer

verifed

verified

Showing 1 - 20 of 25

Related Exams

Show Answer