Q.1 Which of the following is a selection statement in Java?
if()
for()
break
None of these
Explanation
Selection statements like ‘if’ and ‘switch’ are used to control the flow of a program based on a condition.
Q.2 Which of the following is an iterative statement in Java?
if()
for()
break
None of these
Explanation
Iterative statements, or loops, like ‘for’, ‘while’, and ‘do-while’ are used to repeat a block of code.
Q.3 Which of the following is an entry-controlled loop?
while()
do while()
break()
None of these
Explanation
In an entry-controlled loop, the condition is evaluated before the execution of the loop body.
Q.4 Which of the following is an exit-controlled loop?
while()
do while()
break()
None of these
Explanation
In an exit-controlled loop like ‘do-while’, the loop body is executed at least once before the condition is checked.
Q.5 What is the correct syntax of a While loop?
initialization; while (condition) { body; increment/decrement; }
increment/decrement; initialization; while (condition) { body; }
(initialization value ;condition;increment/decrement)
None of these
Explanation
The standard structure involves initializing a variable, checking the condition in the while header, and updating the variable inside the block.
Q.6 True or False: The switch statement does not require a break statement.
True
False
None of these
N/A
Explanation
While technically it compiles without breaks, a break is functionally required to prevent ‘fall-through’ to the next case.
Q.7 True or False: The while loop repeats a set of code while the condition is false.
True
False
None of these
N/A
Explanation
A while loop repeats its code block only as long as the specified condition remains true.
Q.8 True or False: The do-while loop repeats a set of code at least once before the condition is tested.
True
False
None of these
N/A
Explanation
Because the condition is checked at the end of the block, the do-while loop always executes its body at least once.
Q.9 True or False: The for loop repeats a set of statements a certain number of times until a condition is matched.
True
False
None of these
N/A
Explanation
The for loop is ideal when the number of iterations is known or depends on a specific counter/condition.
Q.10 Which of the following will execute the body even when the condition controlling the loop is initially false?
switch
if
for
None of these
Explanation
Based on the provided answer key, switch is identified; normally, among actual loops, the ‘do-while’ loop is the one that executes at least once regardless of the condition.