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

Discussion

An expression tree contains 7 binary operators and no unary ones. Translating it with one operator per instruction yields how many temporaries?

  • A.8
  • B.14
  • C.7
  • D.6

Answer: C

Each binary operator yields exactly one result, and each result needs one temporary, so the counts are equal: \[ \text{temporaries} = \text{operators} = 7 \] Optimisation may afterwards reduce how many actually occupy storage, since a temporary that is consumed immediately need not survive; register allocation is where that reduction really happens. The count of 7 is the number generated, not the number ultimately stored.

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

Post your comment

Please log in or register to post a comment.