WorksheetsJava Chapter 5 Review Questions
Total questions: 20
Worksheet time: 10mins
This type of method does not return a value
null
void
empty
anonymous
This appears at the beginning of a method definition
semicolon
parenthesis
body
header
The body of a method is enclosed in:
curly braces { }
square brackets [ ]
parentheses ( )
quotation marks " "
A method header can contain:
method modifiers
the method return type
The method name
a list of parameter declarations
all of these
A value that is passed into a method when it is called is known as a(n):
parameter
argument
signal
return value
A variable that receives a value that is passed into a method is known as a(n):
parameter
argument
signal
return value
This javadoc tag is used to document a parameter variable
@parameter
@param
@paramvar
@arg
This statement causes a method to end and sends a value to the statement that called the method
end
send
exit
return
This javadoc tag is used to document a method's return value
@methodreturn
@ret
@return
@returnval
You terminate a method header with a semicolon
True
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
True
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
True
False
A parameter variable's scope is the entire program that contains the method in which the parameter is declared
True
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
True
False
When an object, such as a String, is passed as an argument, it is actually a reference to the object that is passed.
True
False
The contents of a String object cannot be changed.
True
False
When passing multiple arguments to a method, the order in which the arguments are passed is not important.
True
False
No two methods in the same program can have a local variable with the same name.
True
False
It is possible for one method to access a local variable that is declared in another method
True
False
You must have a return statement in a value-returning method
True
False
