Page contents

Java Foundations 3rd Edition By John Lewis- Test Bank

Instant delivery only

  • ISBN-10 ‏ : ‎ 0133370461
  • ISBN-13 ‏ : ‎ 978-0133370461

In Stock

$28.00

Add to Wishlist
Add to Wishlist
Compare
SKU:tb1002658

Java Foundations 3rd Edition By John Lewis- Test Bank

Chapter 9: Polymorphism

Multiple Choice Questions:

1) A polymorphic reference is one that can refer to _______________ type(s) of object(s).

a) exactly one
b) zero
c) multiple
d) abstract
e) static

Answer: c
Explanation: A polymorphic reference can point to multiple types of objects at different points in time.

2) The commitment to execute certain code to carry out a method invocation is referred to as _________________.

a) execution
b) binding
c) polymorphism
d) inheritance
e) none of the above

Answer: b
Explanation: Binding refers to the commitment to execute certain code to carry out a method invocation.

3) In Java, polymorphic method binding occurs ____________________ .

a) at run time
b) at compile time
c) never
d) when a programmer writes the code
e) during the testing phase of software development

Answer: a
Explanation: polymorphic method binding occurs at run-time.

4) Late binding is _______________ than _______________ .

a) more efficient, compile-time binding
b) less efficient, compile-time binding
c) more efficient, run-time binding
d) less efficient, run-time binding
e)

Answer: b
Explanation: Late binding is less efficient than compile-time binding due to the overhead associated with determining the code that should be executed at run time.

5) Suppose that Horse is a subclass of Animal, and neither class is abstract. Which of the following is an invalid declaration and initialization?

a) Horse h = new Horse();
b) Horse h = new Animal();
c) Animal a = new Animal();
d) Animal a = new Horse();
e) all of the above are valid

Answer: b
Explanation: Since Horse is a subclass of Animal, choice b would require an explicit class.

6) In Java, a(n) ___________________ is a collection of constants and abstract methods.

a) polymorphic reference
b) abstract class
c) implementation
d) interface
e) iterator

Answer: d
Explanation: An interface is a collection of constants and abstract methods.

7) In Java, polymorphic references can be created through the use of __________________ and ________________.

a) inheritance, interfaces
b) inheritance, abstract classes
c) interfaces, abstract classes
d) interfaces, iterators
e) none of the above

Answer: a
Explanation: In Java, polymorphic references can be created through the use of inheritance and interfaces.

Reviews

There are no reviews yet.

Write a review

Your email address will not be published. Required fields are marked *

Product has been added to your cart