Java Chapter 11
If you attempt to instantiate an object from an abstract class, you receive an error message from the compiler that you have committed a(n) ____. a. ObjectError b. InstantiationError c. LogicError d. SyntaxError
InstantiationError
____ compress the data they store, which reduces the size of archived class files. a. JAR files b. Dynamic method bindings c. Interfaces d. Type-import-on-demand declarations
JAR files
When you define a class, if you do not explicitly extend another class, your class is an extension of the ____ class. a. Object b. public c. abstract d. super
Object
If you do not specify a package for a class, it is placed in an unnamed ____ package. a. general b. system c. default d. language
default
An application's ability to select the correct subclass method is known as ____. a. implementing methods b. implicit casting c. method fixing d. dynamic method binding
dynamic method binding
If Java did not allow you to ____ classes, you would need to create every part of a program from scratch. a. import b. override c. extend d. abstract
extend
You sometimes create an abstract class only so you can ____ it to another class. a. copy b. link c. abstract d. extend
extend
Java's Object class contains a public method named ____ that returns an integer representing the hash code. a. toString() b. hashCode() c. hcode() d. length()
hashCode()
When a class both extends and implements, by convention the ____ clause follows the extends clause in the class header. a. implements b. extends c. if d. new
implements
When you assign a variable or constant of one type to a variable of another type, the behavior is called ____. a. implicit conversion b. referencing c. dynamic method binding d. containing
implicit conversion
A(n) ____ looks much like a class, except that all of its methods (if any) are implicitly public and abstract. a. collision b. interface c. hash code d. package
interface
When you show abstract classes and methods in class diagrams, their names appear in ____. a. italics b. all caps c. blue d. bold
italics
The capability to inherit from more than one class is called ____. a. collision b. polyinheritance c. multiple inheritance d. dynamic method binding
multiple inheritance
Classes, such as the String class, have their own equals() methods that overload the ____ class method. a. Child b. Abstract c. Public d. Object
object
Instead of using the automatic toString() method with your classes, it is usually more useful to write your own ____ version of the toString() method that displays some or all of the data field values for the object with which you use it. a. overloaded b. condensed c. protected d. static
overloaded
A(n) ____ is not an object, but it points to a memory address. a. extend b. interface c. abstract class d. reference
reference
The Object class ____ method converts an Object into a String that contains information about the Object. a. setType() b. equals() c. toString() d. speak()
toString()
The ____ method is useful in debugging a program because it can be used to display and examine values. a. finalize() b. notify() c. toString() d. equals()
toString()
____ is a calculated number that is used to uniquely identify an object. a. Ad-hoc polymorphism b. Implicit conversion c. A hash code d. Method binding
A hash code
Which of the following is NOT true regarding abstract methods? a. Abstract methods must be implemented in child classes. b. Abstract methods use the abstract keyword in declarations. c. Abstract methods have no body. d. Abstract methods are inherited by their children.
Abstract methods are inherited by their children.
Which of the following statements creates an array of three Animal references? a. Animal[] new = ref Animal[3]; b. Animal[] ref = extend Animal[3]; c. Animal[] animalRef = new Animal[3]; d. Animal[] ref = new Animal(3);
Animal[] animalRef = new Animal[3];
A(n) ____ class is a class that you create only to extend from. a. final b. inheritance c. parent d. abstract
abstract
The Object class equals() method returns a(n) ____ value indicating whether the objects are equal. a. null b. equals c. int d. boolean
boolean
When you create a class and use the implements clause to implement an interface but fail to code one of the interface's methods, the compiler error generated indicates that you must declare your class to be ____. a. static b. public c. related d. abstract
abstract
When you create a new subclass in Java, neither the superclass source code nor the superclass ____ is changed. a. argument b. possession c. bytecode d. object
bytecode