Parsing: GATE CS Previous Year Questions

Parsing · Compiler Design

58 questions · asked in 25 of 27 years (2000–2026)

MCQ 46 · MSQ 5 · NAT 71-mark 39 · 2-mark 19

2000Questions per year2026

Questions 21–25 of 58

Q21GATE 2015 (Session 3)1 markMCQ−0.33 if wrong
Among simple LR (SLR) , canonical LR, and look-ahead LR (LALR), which of the following pairs identify the method that is very easy to implement and the method that is the most powerful , in that order?

Q22GATE 2015 (Session 3)2 marksMCQ−0.67 if wrong
Consider the following grammar
S →\rightarrow F|H
F →\rightarrow p|c
H →\rightarrow d|c
where S,F, and H are non-terminal symbols, p,d, and c are terminal symbols. Which of the following statement(s) is/are correct?
S1. LL(1) can parse all strings that are generated using grammar G
S2. LR(1) can parse all strings that are generated using grammar G

Q23GATE 2014 (Session 1)2 marksMCQ−0.67 if wrong
A canonical set of items is given below
S→L.>R\rightarrow L. \gt R
Q→\rightarrowR.
On input symbol <\lt the set has

Q24GATE 2014 (Session 2)1 markMCQ−0.33 if wrong
Consider the grammar defined by the following production rules, with two operators * and +
S →\rightarrowT *P
T →\rightarrowU| T*U
P →\rightarrow Q +P |Q
Q →\rightarrow Id
U →\rightarrow Id
Which one of the following is TRUE?

Q25GATE 20132 marksMCQ−0.67 if wrong
Consider the following two sets of LR(1) items of an LR(1) grammar.

X→c.X,c∕dX→c.X,$X→.cX,c∕  d X→.cX,$X→.d,c∕ d X→.d,$\begin{array}{l|l} X \rightarrow c.X, c∕d &X → c.X, \$\\ X \rightarrow .cX, c∕  d& X → .cX, \$\\ X \rightarrow .d, c∕ d & X → .d, \$ \end{array}

Which of the following statements related to merging of the two sets in the corresponding LALR parser is/are FALSE?
1. Cannot be merged since look aheads are different.
2. Can be merged but will result in S-R conflict.
3. Can be merged but will result in R-R conflict.
4. Cannot be merged since goto on c will lead to two different sets.

Keep practising

Topics in Compiler Design

All CS topics ›