MCQ
Single Best Answer
Easy
QTo execute a loop 10 times, which of the following is correct?
ID: #24263
ICSE Computer Application - Class X - 2025 SPECIMEN QUESTION PAPER
42 views
Question Info
#24263Q ID
EasyDifficulty
ICSE Computer Application - Class X - 2025 SPECIMEN QUESTION PAPERTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer: Option A
Explanation
public class LoopTest { public static void main(String[] args) { int count = 0; // to count iterations for (int i = 11; i <= 30; i += 2) { System.out.println("i = " + i); count++; } System.out.println("Total iterations: " + count); } }
Option (a)
for (int i = 11; i <= 30; i += 2)
-
Sequence: 11, 13, 15, …, 29
-
Total iterations:
(30-11)/2 + 1 = 10✅ -
Looks correct.
Option (b)
for (int i = 11; i <= 30; i += 3)
-
Sequence: 11, 14, 17, …
-
Iterations:
(30-11)/3 + 1 = 7❌ -
Not correct.
Option (c)
for (int i = 11; i < 20; i++)
-
Sequence: 11, 12, …, 19
-
Iterations:
20-11 = 9❌ -
Not correct.
Option (d)
for (int i = 11; i <= 21; i++)
-
Sequence: 11, 12, …, 21
-
Iterations:
21-11+1 = 11❌ -
Not correct.
✅ Answer: (a) for (int i=11;i<=30;i+=2)
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic