Professional Documents
Culture Documents
Test Bank
Visit to download the full and correct content document:
https://testbankdeal.com/download/java-how-to-program-9th-edition-deitel-test-bank/
Chapter 10: Object-Oriented
Programming: Polymorphism
Section 10.1 Introduction
10.1 Q1: 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.
Ans: a. program in the general.
10.5 Q2: If the superclass contains only abstract method declarations, the
superclass is used for:
a. implementation inheritance.
b. interface inheritance.
c. Both.
d. Neither.
Ans: b. interface inheritance.
10.5.1 Q2: 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.
Ans: a. abstract superclasses may contain data.
© Copyright 1992-2012 by Deitel & Associates, Inc. and Pearson Education, Inc.
public abstract class Foo
{
private int a;
public int b;
10.5.6 Q2: Every object in Java knows its own class and can access this information
through method .
a. getClass.
b. getInformation.
c. objectClass.
d. objectInformation.
Ans: a. getClass.
10.6 Q2: 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.
Ans: a. a method in an abstract class.
10.7 Q2: 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.
Ans: d. can be instantiated.
© Copyright 1992-2012 by Deitel & Associates, Inc. and Pearson Education, Inc.
b. 1
c. 2
d. any number of
Ans: d. any number of
© Copyright 1992-2012 by Deitel & Associates, Inc. and Pearson Education, Inc.