Multiple choice technology programming languages

1)main() { int i = 5; printf(“%d %d %d %d %d”,i++,i--,++i,--i,i); }

  1. 5 6 6 5 5

  2. 6 5 6 5 5

  3. 5 5 6 5 5

  4. 4 5 5 4 5

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

In C, the order of evaluation of printf arguments is unspecified. However, the values are computed right-to-left before printing. Starting from i=5: i++ makes 6, i-- makes 4, ++i makes 5, --i makes 4, and i is 4. But compilers may vary. On systems producing 4 5 5 4 5, this matches option D. This tests understanding of increment/decrement operators and evaluation order.