ICSE Class 10 Computer Applications Question 22 of 30

Solved 2024 Specimen Paper ICSE Class 10 Computer Applications — Question 22

Back to all questions
22
Question

Question 2(ii)

Evaluate the expression when the value of x = 2:

x = x++ + ++x + x

Answer
Output
10
Explanation

Initially, x = 2. The expression is calculated as follows:

x = x++ + ++x + x
x = 2 + ++x + x          (x = 3)
x = 2 + 4 + x               (x = 4)
x = 2 + 4 + 4               (x = 4)
x = 10