MCQ
Single Best Answer
Moderate
QIn which of the following languages is the for loop index explicitly declared?
ID: #23073
For Loop in Programming Language
68 views
Question Info
#23073Q 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 B
Explanation
In Java, the for loop index is explicitly declared as a part of the loop structure. For example, for (int i = 0; i < 10; i++), where int i is the explicit declaration of the index. In Python, the for loop doesn't require explicit declaration of the loop index; it's directly inferred from the iterable object being looped over. Ruby and JavaScript also handle the loop index differently, where the loop variable may be initialized automatically or inferred from an iterable.
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic