Java - MCQ
Multiple Choice Questions
Java MCQ - Loops, Decisions and Mathematical functions - Set 20
1. Which of the following is used with the switch statement?
A). continue
B). exit
C). break
D). do
View Answer
Correct: C
2. What is the valid data type for variable “a” to print “Hello World”?
switch(a)
{
System.out.println("Hello World");
}
A). int and float
B). byte and short
C). char and long
D). byte and char
View Answer
Correct: D
3. Which of the following is not a decision making statement?
A). if
B). if-else
C). switch
D). do-while
View Answer
Correct: D
4. Which of the following is not a valid jump statement?
A). break
B). goto
C). continue
D). return
View Answer
Correct: B
5. From where break statement causes an exit?
A). Only from innermost loop
B). Terminates a program
C). Only from innermost switch
D). From innermost loops or switches
View Answer
Correct: D