Java chapter 5

Ace your homework & exams now with Quizwiz!

The body of a method is enclosed in ________. a. curly braces {} b. square brackets [] c. parentheses () d. quotation marks ""

a. curly braces {}

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

a. parameter

This javadoc tag is used to document a parameter variable. a. @parameter b. @para c. @paramvar d. @arg

b. @para

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

b. argument

this type of method does not return a value. a. null b. void c. empty d. anonymous

b. void

this javadoc tag is used to document a method's return value a. @methodreturn b. @ret c. @return d. @returnval

c. @return

This appears at the beginning of a method definition. a. semicolon b. parentheses c. body d. header

d. header

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

d. return

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 theses f. none of these

e. all of these

true or false. a parameter variable's scope is the entire program that contains the method in which the parameter is declared

false

true or false. it is possible for one method to access a local variable that is declared in another method.

false

true or false. no two methods in the same program can have a local variable with the same name.

false

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.

false

true or false. when passing an argument to a method, java will automatically perform a narrowing conversion when necessary.

false

true or false. when passing multiple arguments to a method, the order in which the arguments are passed is not important.

false

true or false. you terminate a method header with a semicolon.

false

true or false. the contents of a string object cannot be changed

true

true or false. when an object, such as String, is passed as an argument, it is actually a reference to the object that is passed.

true

true or false. when passing an argument to a method, java will automatically perform a widening conversion, if necessary

true

true or false. you must have a return statement in a value-returning method

true


Related study sets

MBUS300 - Final Exam (Financial Chapters 1-3, Management 1-3)

View Set

CH 9 : MUSCLES AND MUSCLE TISSUSES, FINAL REVIEW

View Set

B1 - frases para completar con pronombres de OI y OD

View Set

Ch. 1 - Physical Fitness and Wellness

View Set