Evaluate C++ expressions.

Q18. Evaluate the following C++ expressions where a, b, c are integers and d, f are floating point numbers. The value of a = 5, b = 3 and d = 15.

  1. f = a + b / a
  2. c = d * a + b
  3. c = (a++) * d + a
  4. f = (++b) * b – a
  5. c = a – (b++) * (–a)

Ans.(1). 5.

Ans.(2). 78.

Ans.(3). 80.

Ans.(4). 11.

Ans.(5). -8.

Leave a Reply

Your email address will not be published. Required fields are marked *

273 Views
%d bloggers like this: