← Quiz: C Control Flow: all 10 questions
Quiz: C Control Flow · Question 10 of 10
When is a while loop a more natural choice than a for loop?
When is a while loop a more natural choice than a for loop?
- A.When you know exactly how many times to repeat
- B.When you repeat until something changes and do not know the number of rounds in advance
- C.When the body must run at least once
- D.When you need a loop counter
Answer & explanation
Correct answer: When you repeat until something changes and do not know the number of rounds in advance
For example, reading numbers until the user enters 0; for loops suit a known count, do-while a body that runs at least once.
Can you get the rest right without peeking?
Take the timed Quiz: C Control Flow quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →