Evaluate the expression when the value of x = 2:

ICSE Class 10 Computer Applications PYQ · 2024 Specimen · Section A

2(ii)1 Mark · 2024 · Section A · 2024 Specimen

Evaluate the expression when the value of x = 2:

x = x++ + ++x + x

Show SolutionHide Solution↓
10

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

← Previous questionNext question →

Share on WhatsApp

Browse the free Computer Applications sample bank