ICSE Class 10 Computer Applications
Question 17 of 30
Solved 2025 Specimen Paper ICSE Class 10 Computer Applications — Question 17
Back to all questionsBoth A and C
Reason — The student's code x = +2; is incorrect because it doesn't actually increment x by 2. Instead, it simply assigns the value +2 to x.
The correct way to increment the value of x by 2 is:
Option A:
x += 2;
This is shorthand forx = x + 2;and correctly incrementsxby 2.Option C:
x = x + 2;
This is the full, explicit version of incrementingxby 2. It is also correct.
Option B: x = 2;
This assigns 2 to x, which is not incrementing its value. Hence, this is incorrect.