Gate CS-2010 Question Paper With Solutions

Q. 15 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 register, what is the
minimum number of registers needed to execute this program without spilling ?

(A) 2

(B) 3

(C) 4

(D) 6

Answer: (B)

Explanation:

Gate CS-2010 Question Paper With Solutions Gate CS-2010 Question Paper With Solutions

Learn More:   Gate EE-2003 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here