ICSE Class 10 Computer Applications
Question 25 of 30
Solved 2025 Specimen Paper ICSE Class 10 Computer Applications — Question 25
Back to all questionsThe loop executes two times.
Output
20
22
Explanation:
Step-by-Step Execution of the Code
Initial Value of x:x = 10
Iteration 1:System.out.println(x++ * 2);
x++→ Use the current value ofx(10), then incrementxto 11.- Output:
10 * 2 = 20
if (x % 3 == 0):
x = 11, so11 % 3 = 2→ Condition isfalse.
Iteration 2:System.out.println(x++ * 2);
x++→ Use the current value ofx(11), then incrementxto 12.- Output:
11 * 2 = 22
if (x % 3 == 0):
x = 12, so12 % 3 = 0→ Condition istrue.
break;
- The
breakstatement exits the loop.