CD |Gate-2010| Compiler Design
1. Which data structure in a compiler is used for managing information about variables and their attributes? [GATE – 2010]
a. Abstract syntax tree
b. Symbol Table
c. Semantic Stack
d. Parse Table
Answer : b)
2. Which languages necessarily need heap allocation in the runtime environment? [GATE – 2010]
a. Those that support recursion
b. Those that use dynamic scoping
c. Those that allow dynamic data structures
d. Those that use global variables
Answer : c)
3. 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? [GATE – 2010]
a. 2
b. 3
c. 4
d. 6
Answer : b)
4. The grammar S → aSa|bS|c is : [GATE – 2010]
a. Both LL(1) and LR(1)
b. LR(1) but not LR(1)
c. LL(1) but not LR(1)
d. Neither LL(1) nor LR(1)
Answer : a)
CD |Gate-2010|