Name:     ID: 
 
Email: 

Test4

True/False
Indicate whether the statement is true or false.
 

 1. 

When a Java program is executing, the computer's memory must hold all class templates in their compiled form, variables that refer to objects, and objects as needed.
 

 2. 

The identity of an object is simply the variable that references the object.
 

 3. 

A class's implementation details can be changed radically without affecting any of its clients provided its interface remains the same.
 

 4. 

In Java it is illegal to have two variables referencing the same object.
 

 5. 

The keyword public indicates that the class is accessible to all potential clients.
 

 6. 

Constructors do not have return types, but all other methods do.
 

 7. 

A class can include only one constructor.
 

 8. 

A method can only have one return statement.
 

 9. 

Variables declared within any compound statement enclosed in braces are said to have local scope.
 

 10. 

Global variables can be reused within several different methods without causing a conflict.
 

 11. 

A good way to provide temporary storage is to use global variables.
 

 12. 

When using turtle graphics, the color of a pen cannot be changed.
 

Multiple Choice
Identify the choice that best completes the statement or answers the question.
 

 13. 

The process of creating a new object is called:
a.
encapsulation
c.
instantiation
b.
class
d.
new
 

 14. 

Java deletes objects from memory in a process called:
a.
deletion
c.
memory allocation
b.
garbage collection
d.
memory dumping
 

 15. 

Which characteristic of an object says that at any moment its instance variables have particular values.
a.
state
c.
identity
b.
behavior
d.
instantiation
 

 16. 

What is the list of the methods supported by the server referred to as?
a.
encapsulation
c.
behavior
b.
state
d.
interface
 

 17. 

Messages that change an object's state are called:
a.
accessors
c.
mutators
b.
constructors
d.
methods
 

 18. 

What is the name of a method that indicates how to initialize a new object?
a.
initializer
c.
mutator
b.
constructor
d.
accessor
 

 19. 

If class A extends class B, class B is the _________ of class A.
a.
parent
c.
nephew
b.
child
d.
subclass
 

 20. 

If a class A omits the extends <some class> clause, which class is assumed to be the superclass of class A.
a.
Object
c.
System
b.
KeyboardReader
d.
Math
 

 21. 

What are activated when the keyword new is used and at no other time.
a.
accessors
c.
constructors
b.
mutators
d.
methods
 

 22. 

A method whose implementing code is omitted is called a:
a.
accessor
c.
helper
b.
mutator
d.
stub
 

 23. 

Values passed to a method when it is invoked are called:
a.
actual parameters
c.
constructors
b.
formal parameters
d.
initial values
 

 24. 

To provide temporary working storage for data in a method a programmer can declare:
a.
global variables
c.
instance variables
b.
local variables
d.
classes
 

 25. 

The ________ of a variable is that region of the program within which it can validly appear in lines of code.
a.
lifetime
c.
value
b.
type
d.
scope
 

 26. 

Variables defined as instance variables of a class are referred to as:
a.
local
c.
temporary
b.
global
d.
public
 

 27. 

The _________ of a variable is the period during which it can be used.
a.
time period
c.
lifetime
b.
scope
d.
type
 

Completion
Complete each statement.
 

 28. 

An object has _________ as defined by the methods of its class.
 

 

 29. 

If a reference variable of an object is set to _______, and no other variable points to that object, the computer reclaims the object's memory during garbage collection.
 

 

 30. 

Using the visibility modifier __________ for instance variables is an important aspect of information hiding.
 

 

 31. 

Constructors with empty parameter lists are called ___________ constructors.
 

 

 32. 

Parameters listed in a method's definition are called ________ parameters.
 

 

 33. 

Methods that are usually private that help break down tasks to reduce complexity are called _________ methods.
 

 

 34. 

A programmer uses the symbol ______ to refer to the current instance of a class within that class's definition.
 

 

 35. 

The default width of a pen in turtle graphics is two ________, or picture elements.
 

 

Short Answer
 

 36. 

When messages are sent, which two objects are involved?
 



 
         Start Over