ICSE Class 10 Computer Applications Question 22 of 30

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

Back to all questions
22
Question

Question 2(ii)

Evaluate the given expression when the value of a=2 and b=3

b*=a++ - ++b + ++a;
System.out.println("a= "+a); 
System.out.println("b= "+b);
Answer

a = 4, b = 6

Explanation:

The given expression is evaluated as follows:

b*=a++ - ++b + ++a
b = b * (a++ - ++b + ++a) [a=2, b=3]
b = 3 * (2 - 4 + 4) [a=4, b=4]
b = 3 * 2
b = 6