GATE Computer ScienceModerateGATE CSE

Three-address code (at most one operator per instruction, the last instruction assigning to x) is generated for x = a*b + c*(d − e) − f/g. How many instructions are generated?

  1. A. 6
  2. B. 5
  3. C. 7
  4. D. 4

Correct answer: A. 6

The expression has six operators (*, −, *, +, /, −), and each gets one instruction, with the last storing directly into x.

More Compiler Design questions

Exams that ask this topic