Machine-translated by Google. Questions are authored in English.
Top

Discussion

The expression (a + b) * (c - d) is translated into three address code with one operator per instruction. How many instructions are produced?

  • A.5
  • B.3
  • C.2
  • D.4

Answer: B

With one operator per instruction, the instruction count equals the operator count. The expression \( (a+b)*(c-d) \) contains three operators, so \[ n = 3 \] namely \( t_1 = a + b \), \( t_2 = c - d \), and \( t_3 = t_1 * t_2 \). Three temporaries are introduced, the last holding the value of the whole expression.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.