The Gateway to Computer Science Excellence

+1 vote

Consider the following code segment:

The minimum number of temporary variable required to convert the above code segment to static single assignment form is ________.

+1

Given answer is 4, but i got 5.5 variables on LHS is needed.I dont think we can do any minimization here?

0

minimization can be done actually because 'e' is same as 'b'.

if we assign no variable for 'e' then it will be 4

if we assign no variable for 'e' then it will be 4

+1

I think it is 0.

As in static single assignment form a variable can be assigned only once. Here there are no repeated assignment of same variable.

As in static single assignment form a variable can be assigned only once. Here there are no repeated assignment of same variable.

+3

Please someone clear my doubt.

In SSA, we need that each variable be assigned value only once. And use temporary variables if required.

Here the given code is already in SSA. And we don't need any extra variables, or to say any "temporary" variables. So answer should be 0.

In case if it asked for** total ****numer**** of variables**, then the answer should be non-zero.

Right?

0

Yes, @Rishabh Gupta 2 .

Given 3-Address Code is Already in SSA Form, hence, we need No temp variable to convert it into SSA.

0 votes

I guess answer would be **0, **because the above code is already in Static single assignment form.

Refer to this links.

https://www.cs.cmu.edu/~fp/courses/15411-f08/lectures/09-ssa.pdf

https://www.geeksforgeeks.org/gate-gate-cs-2016-set-1-question-29/

0 votes

0

Why are people saying that answer is **0** in the above comments ? I am getting answer as **4.**

In the below mentioned GATE 2016 question, the answer is **10** including the temporary variables. My doubt is if the number of temporary variables had to be considered as **0 **then the answer should have been **5** right and not 10 considering the fact that we have to convert this code segment in to SSA form.

**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 ?**

Somebody please provide a clear understanding on this.

- All categories
- General Aptitude 1.9k
- Engineering Mathematics 7.5k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.4k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.2k
- Non GATE 1.4k
- Others 1.4k
- Admissions 595
- Exam Queries 573
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 18

50,737 questions

57,382 answers

198,530 comments

105,323 users