Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Java Chapter 5 Review Questions

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
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)

parenthesis

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

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 javadoc 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 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.

You terminate a method header with a semicolon

a)

True

b)

False

11.

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

a)

True

b)

False

12.

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

a)

True

b)

False

13.

A parameter variable's scope is the entire program that contains the method in which the parameter is declared

a)

True

b)

False

14.

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

a)

True

b)

False

15.

When an object, such as a String, is passed as an argument, it is actually a reference to the object that is passed.

a)

True

b)

False

16.

The contents of a String object cannot be changed.

a)

True

b)

False

17.

When passing multiple arguments to a method, the order in which the arguments are passed is not important.

a)

True

b)

False

18.

No two methods in the same program can have a local variable with the same name.

a)

True

b)

False

19.

It is possible for one method to access a local variable that is declared in another method

a)

True

b)

False

20.

You must have a return statement in a value-returning method

a)

True

b)

False