Skip to content

GATE CS Parsing (LL, LR) questions

Practise Parsing (LL, LR) questions for GATE CS. Explore official PYQs and original topic-wise quizzes, check answers and view available solutions. Free, no sign-in.

Subject, topic, year and type filter the full library. Match any choice within a filter, and all selected filter categories. Search, source and sort apply to this page.

20 on this page
Official PYQ2026Compiler DesignParsing (LL, LR)MCQ · 1 mark
Which of the following statements is/are true?
Official PYQ2026Compiler DesignParsing (LL, LR)MCQ · 2 marks
Consider the control flow graph shown in the figure. Which one of the following options correctly lists the set of redundant expressions (common subexpressions) in the basic blocks B44 and B55? Note: All the variables are integers.
Official PYQ2026Compiler DesignParsing (LL, LR)MSQ · 1 mark
Which of the following grammars is/are ambiguous?
Official PYQ2026Compiler DesignParsing (LL, LR)MCQ · 2 marks
Consider the canonical LR(0)L R(0) parsing of the grammar below using terminals {a,b,c}\{a, b, c\} and non-terminals {A,B,C,S}\{A, B, C, S\} with SS as the start symbol. S→ACBA→aA∣ϵC→cC∣ϵB→bB∣b\begin{array}{l} S \rightarrow A C B \\ A \rightarrow a A \mid \epsilon \\ C \rightarrow c C \mid \epsilon \\ B \rightarrow b B \mid b \end{array} Which one of the following options gives the …
Official PYQ2025Compiler DesignParsing (LL, LR)MSQ · 2 marks
Which of the following statement(s) is/are TRUE while computing First⁡\operatorname{First} and Follow⁡\operatorname{Follow} during top down parsing by a compiler?
Official PYQ2025Compiler DesignParsing (LL, LR)MSQ · 2 marks
Consider two grammars G1G_{1} and G2G_{2} with the production rules given below: G1:S→G_{1} : S \rightarrow ifif EE thenthen SS ∣| ifif EE thenthen SS elseelse SS ∣| aa E→bE \rightarrow b G2:S→G_{2} :S \rightarrow ifif EE thenthen SS ∣| MM M→M \rightarrow ifif EE thenthen MM elseelse SS ∣| cc …
Official PYQ2025Compiler DesignParsing (LL, LR)MCQ · 2 marks
​​Given a Context-Free Grammar G\text{G} as follows: S→Aa∣bAc∣dc∣bdaA→d\begin{array}{l} S \rightarrow A a|b A c| d c \mid b d a \\ A \rightarrow d \end{array} Which ONE of the following statements is TRUE?
Official PYQ2024Compiler DesignParsing (LL, LR)MSQ · 1 mark
Which of the following is/are Bottom-Up Parser(s)?
Official PYQ2024Compiler DesignParsing (LL, LR)NAT · 1 mark
Consider the operator precedence and associativity rules for the integer arithmetic operators given in the table below. …
Official PYQ2024Compiler DesignParsing (LL, LR)NAT · 2 marks
Let G=(V,Σ,S,P)G=(V, \Sigma, S, P) be a context-free grammar in Chomsky Normal Form with Σ={a,b,c}\Sigma=\{a, b, c\} and VV containing 1010 variable symbols including the start symbol SS. The string w=a30b30c30w=a^{30} b^{30} c^{30} is derivable from SS. The number of steps (application of rules) in the derivation S→∗wS \rightarrow^* w is __________.
Official PYQ2024Compiler DesignParsing (LL, LR)MSQ · 2 marks
​​​​Consider a context-free grammar G\text{G} with the following 33 rules. S→aS,S→aSbS,S→cS \rightarrow a S, S \rightarrow a S b S , S \rightarrow c Let w∈L(G)w \in L(G). Let na(w),nb(w),nc(w)n_{a}(w), n_{b}(w), n_{c}(w) denote the number of times a,b,ca, b, c occur in ww, respectively. Which of the following statements is/are TRUE?
Official PYQ2024Compiler DesignParsing (LL, LR)NAT · 2 marks
Consider the following augmented grammar, which is to be parsed with a SLR\text{SLR} parser. The set of terminals is {a,b,c,d,#,@}\{a, b, c, d, \#, @\} S′→SS→SS∣Aa∣bAc∣Bc∣bBaA→d#B→@\begin{array}{l} S^{\prime} \rightarrow S \\ S \rightarrow S S|A a| b A c|B c| b B a \\ A \rightarrow d \# \\ B \rightarrow @ \end{array} Let …
Official PYQ2022Compiler DesignParsing (LL, LR)MCQ · 1 mark
Which one of the following statements is TRUE?\text{TRUE}?
Official PYQ2022Compiler DesignParsing (LL, LR)NAT · 1 mark
Consider the augmented grammar with {+,∗,(,),id}\{ +, {\ast}, (,),\text{id} \} as the set of terminals. S’→SS’ \rightarrow S S→S+R  ∣  RS \rightarrow S + R\; |\; R R→R∗P  ∣  PR \rightarrow R {\ast} P \;| \;P P→(S)  ∣  idP \rightarrow (S)\; |\; \text{id} If I0I_{0} is the set of two LR(0)\textit{LR}(0) items {[S’→S.],[S→S.+R]}\{ [S’ \rightarrow S.], [S \rightarrow S. + R] \}, then …
Official PYQ2021Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider the following statements. S1:S_1: Every SLR(1)\text{SLR(1)} grammar is unambiguous but there are certain unambiguous grammars that are not SLR(1)\text{SLR(1)}. S2:S_2: For any context-free grammar, there is a parser that takes at most O(n3)O(n^3) time to parse a string of length nn. Which one of the following options is correct?
Official PYQ2021Compiler DesignParsing (LL, LR)MCQ · 2 marks
Consider the following context-free grammar where the set of terminals is {a,b,c,d,f}\{a,b,c,d,f\}. …
Official PYQ2021Compiler DesignParsing (LL, LR)NAT · 2 marks
Consider the following augmented grammar with {#,@,<,>,a,b,c}\{ \#, @, <, >, a, b, c \} as the set of terminals. S’→SS→S#cSS→SSS→S@S→<S>S→aS→bS→c\begin{array}{l} S’ \rightarrow S \\ S \rightarrow S \# cS \\ S \rightarrow SS \\ S \rightarrow S @ \\ S \rightarrow < S > \\ S \rightarrow a \\ S \rightarrow b \\ S \rightarrow c \end{array}Let …
Official PYQ2020Compiler DesignParsing (LL, LR)NAT · 1 mark
Consider the following grammar. S→aSB∣dS \rightarrow aSB \mid d B→bB \rightarrow b The number of reduction steps taken by a bottom-up parser while accepting the string aaadbbbaaadbbb is ___________.
Official PYQ2019Compiler DesignParsing (LL, LR)MCQ · 1 mark
Which one of the following kinds of derivation is used by LR parsers?
Official PYQ2019Compiler DesignParsing (LL, LR)NAT · 2 marks
Consider the augmented grammar given below: S’→SS’ \rightarrow S S→⟨L⟩∣idS \rightarrow \langle L \rangle \mid id L→L,S∣SL \rightarrow L, S \mid S Let I0=CLOSURE({[S’→⋅S]}).I_0 = \text{CLOSURE} (\{[S’ \rightarrow \cdot S ]\}). The number of items in the set GOTO(I0,⟨ )\text{GOTO} (I_0, \langle \: ) is______