ICSE Class 10 Computer Applications
Question 8 of 69
Iterative Constructs in Java — Question 8
Back to all questions 8
Question Question 6
What are the differences between while loop and do-while loop?
| do-while loop | while loop |
|---|---|
| do-while is an exit-controlled loop. | while is an entry-controlled loop. |
| do-while loop checks the test condition at the end of the loop. | while loop checks the test condition at the beginning of the loop. |
| do-while loop executes at least once, even if the test condition is false. | while loop executes only if the test condition is true. |
| do-while loop is suitable when we need to display a menu to the user. | while loop is helpful in situations where number of iterations is not known. |