MCQ
Single Best Answer
Moderate
QHow does a for-each loop differ from a traditional for loop?
ID: #23078
For Loop in Programming Language
80 views
Question Info
#23078Q ID
ModerateDifficulty
For 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 for-each loop (or enhanced for loop) is specifically used to iterate over elements in a collection or array, but it does so without requiring an explicit index or counter. The for-each loop automatically handles the iteration through the elements, simplifying the syntax and making the code more readable. It does not allow for modifying the loop control variable directly, which distinguishes it from traditional for loops.
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic