...
Database-Management-System
December 10, 2023
Nielit Scientist-B CS 2016 march
December 10, 2023
Database-Management-System
December 10, 2023
Nielit Scientist-B CS 2016 march
December 10, 2023

Question 8186 – Compiler-Design

The least number of temporary variables required to create a three-address code in static single assignment form for the expression q + r/3 + s – t * 5 + u * v/w is _________.

Correct Answer: A

Question 21 Explanation: 
We will need one temporary variable for storing the result of every binary operation as Static Single Assignment implies the variable cannot be repeated on left hand side of assignment.
The given expression:
q+r/3+s−t∗5+u∗v/w

t1=r/3;
t2=t∗5;
t3=u∗v;
t4=t3/w;
t5=q+t1;
t6=t5+s;
t7=t6−t2;
t8=t7+t4;
So in total we need 8 temporary variables. If it was not mentioned as static single assignment then answer would have been 3 because we can re-use the same temporary variable several times.

A
8
B
9
C
10
D
11

Leave a Reply

Your email address will not be published. Required fields are marked *