Flow Control Questions and Answers
Practice ModeShowing 10 of 29 questions
Q11
What data types can a switch statement operate on in Java?
Answer: Option A
Explanation: switch supports int, byte, short, char, String, enum.
Q12
Which keyword is used to test multiple conditions?
Answer: Option B
Explanation: if-else handles multiple branching conditions.
Q13
Which operator checks both conditions must be true?
Answer: Option B
Explanation: && is logical AND.
Q14
Which loop executes zero or more times?
Answer: Option C
Explanation: for and while run only if condition is true.
Q15
What will “continue” inside a for-loop do?
Answer: Option C
Explanation: continue ignores remaining code in that iteration.
Q16
Which statement is illegal in switch?
Answer: Option C
Explanation: continue cannot be used to control switch flow.
Q17
What is used to repeat a block until a condition becomes false?
Answer: Option B
Explanation: loops manage repeated execution.
Q18
Which statement returns control to the caller method?
Answer: Option C
Explanation: return ends method execution.
Q19
The condition inside an if statement must be a:
Answer: Option B
Explanation: Java if requires a boolean expression.
Q20
Which keyword is used to label loops?
Answer: Option D
Explanation: Labels in Java are user-defined identifiers.