CD |Gate-2008| Previous Year Questions| Set-13

Set-15 GATE-2006 CD

CD |Gate-2008| Compiler Design

  1. Which of the following describes a handle (as applicable to LR-parsing) appropriately? [GATE – 2008]

a. It is the position in a sentential form where the next shift or reduce operation will occur.
b. It is non-terminal whose production will be used for reduction in the next step.
c. It is a production that may be used for reduction in a future step along with a position in the sentential form where the next shift or reduce operation will occur.
d. It is the production p that will be used for reduction in the next step along with a position in the sentential form where the right hand side of the production may be found.

Answer : d) 


  1. Some code optimizations are carried out on the intermediate code because : [GATE – 2008]

a. They enhance the portability of the compiler to other target processors
b. Program analysis is more accurate on intermediate code than on machine code
c. The information from dataflow analysis cannot otherwise be used for optimization
d. The information from the front end cannot otherwise be used for optimization

Answer : a)


  1. Which of the following are true? I.A programming language which does not permit global variables of any kind and has no nesting of procedures/functions, but permits recursion can be implemented with static storage allocation II.Multi-level access link (or display) arrangement is needed to arrange activation records only if the programming language being implemented has nesting of procedures/functions III.Recursion in programming languages cannot be implemented with dynamic storage allocation IV.Nesting procedures/functions and recursion require a dynamic heap allocation scheme and cannot be implemented with a stack-based allocation scheme for activation records V.Programming languages which permit a function to return a function as its result cannot be implemented with a stack-based storage allocation scheme for activation records : [GATE – 2008]

a. II and V only
b. I, III and IV only
c. I, II and V only
d. II, III and V only

Answer : a)


  1. An LALR(1) parser for a grammar G can have shift-reduce (S-R) conflicts if and only if : [GATE – 2008]

a. the SLR(1) parser for G has S-R conflicts
b. the LR(1) parser for G has S-R conflicts
c. the LR(0) parser for G has S-R conflicts
d. the LALR(1) parser for G has reduce-reduce conflicts

Answer : b)
CD |Gate-2008|


Back to GATE-HOME


Spread the love

Leave a Comment

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