The least number of temporary variables required to create a three-address…

1999

The least number of temporary variables required to create a three-address code in static single assignment form for the expression a = b * d - c + b * e - c is ______

Answer: C. 5Given: a = b * d - c + b * e - c In Static Single Assignment (SSA) form, each temporary variable is assigned exactly once. A possible three-address code is:…

  1. A.

    3

  2. B.

    4

  3. C.

    5

  4. D.

    6

Attempted by 60 students.

Show answer & explanation

Correct answer: C

Given: a = b * d - c + b * e - c
In Static Single Assignment (SSA) form, each temporary variable is assigned exactly once.

A possible three-address code is:


t1 = b * d
t2 = t1 - c
t3 = b * e
t4 = t2 + t3
t5 = t4 - c
a  = t5

Here:

t1 stores b∗d
t2 stores b∗d−c
t3 stores b∗e
t4 stores (b∗d−c)+(b∗e)
t5 stores (b∗d−c)+(b∗e)−c

Thus, the least number of temporary variables required is 5

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…