Multiple choice technology programming languages

What will be the value of “num” after the following statements? int num; num = (5+4); num = num / 9; num = 12;

  1. 0

  2. 1

  3. 12

  4. 9

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

Tracing step by step: num = (5+4) sets num to 9; num = num / 9 with integer division gives 9/9 = 1; BUT then num = 12 overwrites this, leaving num as 12. The intermediate division result is irrelevant because the final assignment replaces it.