MCQ
Single Best Answer
Moderate
QIn which scenario would you use a while loop instead of a for loop?
ID: #23086
While Loop in Programming Language
86 views
Question Info
#23086Q ID
ModerateDifficulty
While Loop in Programming LanguageTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer: Option C
Explanation
A while loop is typically used when the number of iterations is unknown or depends on a condition that may change during execution. In contrast, a for loop is usually preferred when the number of iterations is known in advance, such as when iterating through a fixed range. A while loop continues executing as long as its condition remains true, making it ideal for situations where you are waiting for some event to occur or processing input that may vary in length or content.
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic