Important MCQ

A do-while statement ends with

Q.A do-while statement ends with

A) no semicolon
B) a semicolon after while(condition)
C) a colon
D) a comma
Correct Answer:
Option B
Detailed Explanation:
B) a semicolon after while(condition) is correct. A do-while loop executes its body before checking the condition, so it runs at least once. Its closing while(condition) is followed by a semicolon.