wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

AP Java 9-15-2023 (just functions1)

Total questions: 10

Worksheet time: 11mins

Name
Class
Date
1.

Which of the following replacements for /* missing code */ would correctly complete the function?

a)

A only

b)

B only

c)

Both A and B

d)

Neither A nor B

2.

Which of the following replacements for /* missing code */ would correctly complete the function?

a)

answer = number1 * number2;

b)

double answer = number1 + number2;

c)

int answer = number1 * number2;

d)

None of these

3.

Which of the following replacements for /* missing code */ would correctly complete the function?

a)

a + b + c;

b)

return int answer = a + b + c;

c)

return double answer = a + b + c;

d)

return a + b + c;

4.

Which of the following replacements for /* missing code */ would correctly complete the function?

a)

return a + b + c/2;

b)

return a + b + c/3;

c)

return (a + b + c)/2;

d)

return (a + b + c)/3;

5.

Which of the following replacements for /* missing code */ would correctly complete the function?

a)

return num1 / num2;

b)

return num1 % num2;

c)

return num2 % num1;

d)

return num2 / num1;

6.

Which of the following replacements for /* missing code */ would correctly complete the function?

a)

A

b)

B

c)

C

d)

D

7.

Which of the following replacements for /* missing code */ would correctly complete the function?

a)

A only

b)

B only

c)

Both A and B

d)

Neither A nor B

8.

Which of the following replacements for /* missing code */ would correctly complete the function?

a)

A only

b)

B only

c)

Both A and B

d)

Neither A nor B

9.

Which of the following replacements for /* missing code */ would correctly complete the function?

a)

A only

b)

B only

c)

Both A and B

d)

Neither A nor B

10.

Which of the following replacements for /* missing code */ would correctly complete the function?

a)

n >= num

b)

n <= num

c)

num >= n

d)

num <= n