logo

APSU Notes


Quiz 2

Question 1

Which of the following is the correct way to set the value of the variable number to 12?

1
number = 12;

Question 2

Which of the following is a legal identifier?

myVariable

Question 3

Which of the following objects is used to display normal output to the screen?

System.out

Question 4

Which of the following keywords is not required when declaring a named constant?

void

Quesiton 5

Which of following assignments is not legal in Java?

1
int number = 3.14;

Question 6

Given the following statements:

1
2
double number1 = 5.7;
int number2 = (int) number1;

What is the value assigned to the variable number2?

5

Quesiton 7

Which of the following Java operators is used to perform multiplication?

*

Question 8

What does the expression 14 % 5 evaluate to?

4

Question 9

After executing the following statements:

1
2
int number = 7;
number *= 3;

What is the value of the variable number?

21

Question 10

Which of the following statements does not increase the value of the variable number by 1?

number + 1;