Important MCQ

A do-while loop is best suited for

Q.A do-while loop is best suited for

A) menus and input validation
B) headers
C) declaring constants
D) reading comments
Correct Answer:
Option A
Detailed Explanation:
A) menus and input validation 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.