Question discussion

The expression a = b + c * d − e / f is translated into three-address code in which every operator produces a new temporary variable and th…

2563Medium DSSSB TGT Computer Science 0 replies 1 views
0

The expression a = b + c * d − e / f is translated into three-address code in which every operator produces a new temporary variable and the final result is then copied to a. How many temporary variables are needed?

  • A4
  • B3
  • C5
  • D6
Correct answer: A

Explanation

The code is t1 = c * d, t2 = b + t1, t3 = e / f, t4 = t2 − t3 and a = t4, so one temporary per operator, i.e. four temporaries.

Discussion 0

Nobody has replied yet. Start the discussion!