MCQ Practice Single Best Answer Topic: ICSE Computer Application - Class X - 2025 SPECIMEN QUESTION PAPER

Q

A student executes the following code to increase the value of a variable 'x' by 2.

He has written the following statement, which is incorrect.

x = +2;

What will be the correct statement?

A. x +=2;

B. x=2;

C. x=x+2;

Question ID
#24269
Subchapter
ICSE Computer Application - Class X - 2025 SPECIMEN QUESTION PAPER
Action
Choose one option below

Choose Your Answer

Click an option to check whether your answer is correct.

  • A Only A
  • B Only C
  • C All the three
  • D Both A and C
Correct Answer: D

Explanation

Let's carefully analyze the problem:

The student wrote:

x = +2;
  • This does not increase x by 2; it just assigns the value +2 to x.

To increase x by 2, the correct statements are:

  1. x += 2; → This is shorthand for x = x + 2;. ✅

  2. x = x + 2; → Explicitly increases x by 2. ✅

  3. x = 2; → This assigns 2 to x, it does not increase it. ❌

So the correct options are A and C.

Answer: (d) Both A and C

Share This Question

Share this MCQ with your friends or study group.