Discussion
Consider the following code segment :
x = u - t;
y = x * v;
x = y + w;
y = t - z;
y = x * y;The minimum number of total variables required to convert the above code segment to static single assignment form is
Answer: D
The minimum number of variables is 10.
In static single assignment form every assignment creates a new variable:
\[ \begin{aligned} x_{1} &= u - t \\ y_{1} &= x_{1} \times v \\ x_{2} &= y_{1} + w \\ y_{2} &= t - z \\ y_{3} &= x_{2} \times y_{2} \end{aligned} \]
That gives five new variables (\(x_{1}, x_{2}, y_{1}, y_{2}, y_{3}\)) plus the five that are only read (u, t, v, w, z): 10 in all. 6, 8 and 9 reuse a name for two assignments or leave out some of the inputs.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development