C Quiz – 105 | Question 2
In the context of “break” and “continue” statements in C, pick the best statement.
(A) “break” can be used in “for”, “while” and “do-while” loop body.
(B) “continue” can be used in “for”, “while” and “do-while” loop body.
(C) “break” and “continue” can be used in “for”, “while”, “do-while” loop body and “switch” body.
(D) “break” and “continue” can be used in “for”, “while” and “do-while” loop body. But only “break” can be used in “switch” body.
(E) “break” and “continue” can be used in “for”, “while” and “do-while” loop body. Besides, “continue” and “break” can be used in “switch” and “if-else” body.
Answer: (D)
Explanation: As per C standard, “continue” can be used in loop body only. “break” can be used in loop body and switch body only. That’s why correct answer is D.
Quiz of this Question
Please Login to comment...