Catherine Nguyen
2013-10-17 15:00:36 UTC
1. This type of method does not return a value.
a. null
b. void
c. empty
d. anonymous
2. This appears at the beginning of a method definition.
a. semicolon
b. parentheses
c. body
d. header
3. The body of a method is enclosed in __________.
a. curly braces
b. square brackets
c. parentheses
d. quotation marks
4. A method header can contain __________.
a. method modifiers
b. the method return type
c. the method name
d. a list of parameter declarations
e. all of these
f. none of these
5. A value that is passed into a method when it is called is known as a(n) __________.
a. parameter
b. argument
c. signal
d. return value
6. A variable that receives a value that is passed into a method is known as a(n) __________.
a. parameter
b. argument
c. signal
d. return value
7. This tag is used to document a parameter variable.
a. @parameter
b. @param
c. @paramvar
d. @arg
8. This statement causes a method to end and sends a value back to the statement that called the method.
a. end
b. send
c. exit
d. return
9. This javadoc tag is used to document a method’s return value.
a. @methodreturn
b. @ret
c. @return
d. @returnval
10. True or False: You terminate a method header with a semicolon.
11. True or False: When passing an argument to a method, Java will automatically perform a widening conversion (convert the argument to a higher-ranking data type) if necessary.
12. True or False: When passing an argument to a method, Java will automatically perform a narrowing conversion (convert the argument to a lower-ranking data type) if necessary.
13. True or False: A parameter variable’s scope is the entire program that contains the method in which the parameter is declared.
14. True or False: When code in a method changes the value of a parameter, it also changes the value of the argument that was passed into the parameter.
15. True or False: When an object, such as a String, is passed as an argument, it is actually a reference to the object that is passed.
16. True or False: The contents of a String object cannot be changed.
17. True or False: When passing multiple arguments to a method, the order in which the arguments are passed is not important.
18. True or False: No two methods in the same program can have a local variable with the same name.
19. True or False: It is possible for one method to access a local variable that is declared in another method.
20. True or False: You must have a return statement in a value-returning method.
Chapter 6
1. This is a collection of programming statements that specify the fields and methods that a
particular type of object may have.
a. class
b. method
c. parameter
d. instance
2. A class is analogous to a __________.
a. cookie
b. cookie cutter
c. bakery
d. soft drink
3. An object is a(n) __________.
a. blueprint
b. cookie cutter
c. variable
d. instance
4. This is a member of a class that holds data.
a. method
b. instance
c. field
d. constructor
5. This key word causes an object to be created in memory.
a. create
b. new
c. object
d. construct
6. This is a method that gets a value from a class’s field, but does not change it.
a. accessor
b. constructor
c. void
d. mutator
7. This is a method that stores a value in a field or in some other way changes the value of a field.
a. accessor
b. constructor
c. void
d. mutator
8. When the value of an item is dependent on other data, and that item is not updated when the other data is changed, what has the value become?
a. bitter
b. stale
c. asynchronous
d. moldy
9. This is a method that is automatically called when an instance of a class is created.
a. accessor
b. constructor
c. void
d. mutator
10. When a local variable has the same name as a field, the local variable’s name does this to the
field’s name.
a. shadows
b. complements
c. deletes
d. merges with
11. This is automatically provided for a class if you do not write one yourself.
a. accessor method
b. default instance
c. default constructor
d. variable declaration
12. Two or more methods in a class may have the same name, as long as this is different.
a. their return values
b. their access specifier
c. their parameter lists
d. their memory address
13. The process of matching a method call with the correct method is known as __________.
a. matching
b. binding
c. linking
d. connecting
14. A class’s responsibilities are __________.
a. the objects created from the class
b. things the class knows
c. actions the class performs
d. both b and c
15. True or False: The occurrence of a string literal in a Java program causes a String object to be created in memory, initialized with the string literal.
16. True or False: Each instance of a class has its own set of instance fields.
17. True or False: When you write a constructor for a class, it still has the default constructor that Java automatically provides.
18. True or False: A class may not have more than one constructor.
19. True or False: To find the classes needed for an object-oriented application, you identify all of the