• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

GATE | GATE CS 2010 | Question 37

The program below uses six temporary variables a, b, c, d, e, f. 
 

 
    a = 1
    b = 10
    c = 20
    d = a+b
    e = c+d
    f = c+e
    b = c+e
    e = b+f
    d = 5+e
    return d+f


Assuming that all operations take their operands from registers, what is the minimum number of registers needed to execute this program without spilling?
 

(A)

2
 

(B)

3
 

(C)

4
 

(D)

6
 

Answer

Please comment below if you find anything wrong in the above post
Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!

Last Updated :
Share your thoughts in the comments