GATE Compiler Design: Parsing and Syntax Analysis – Previous Year Questions
42 GATE previous year questions on Parsing and Syntax Analysis (Compiler Design, Computer Science) with answers and explanations, from every paper.
42 questions worth 67 marks in all (17 1-mark, 25 2-mark). Asked between 2007 and 2026, so you can see how the topic has been tested over time.
- GATE 2007 CS Q18 – Which is a top-down parser?
- GATE 2007 CS Q52 – Grammar has N=S, C, S1, T=a, b, i, t, e, start S, rules S iCtSS 1 a, S 1 eS, C b. Why is it NOT LL(1)?
- GATE 2007 CS Q53 – P: Every regular grammar is LL(1). Q: Every regular set has an LR(1) grammar. Which is TRUE?
- GATE 2008 CS Q11 – Which best describes a handle in LR parsing?
- GATE 2008 CS Q55 – An LALR(1) parser for grammar G can have shift-reduce conflicts if and only if
- GATE 2021 CS (CS2) Q61 – The augmented grammar is S′→S; S→S#cS SS S@ <S> a b c, with #,@,<,>,a,b,c terminals. Let I0=CLOSURE(S′→·S). Find the number of LR(0) items in…
- GATE 2015 CS (CS3) Q15 – Among SLR, canonical LR and LALR, select the method easiest to implement followed by the most powerful method.
- GATE 2015 CS (CS3) Q65 – Grammar G has S→F H, F→p c, H→d c. S1: LL(1) can parse every string using grammar G. S2: LR(1) can parse every string using grammar G. Which are…
- GATE 2010 CS Q48 – For the grammar S→aSa bSb c, which classification holds?
- GATE 2011 CS Q37 – Binary operator ↓ has lower precedence than ↑. Operator ↑ is right-associative and ↓ left-associative. Which displayed parse tree represents…
- GATE 2013 CS Q19 – A grammar has no ε-productions or unit productions (the source gives types A→ε and A→a). What is the maximum number of bottom-up reduce moves when…
- GATE 2013 CS Q50 – Two LR(1) item sets share core X→c·X, X→·cX, X→·d. Their lookaheads are respectively c,d and end-marker. Which claims about their LALR merge are…
- GATE 2012 CS Q62 – S→aAbB bAaB ε; A→S; B→S. The partial predictive table has S row (E1,E2,S→ε), A row (A→S,A→S,error), B row (B→S,B→S,E3), for lookaheads a,b,end-marker…
- GATE 2012 CS Q63 – S→aAbB bAaB ε; A→S; B→S. The partial predictive table has S row (E1,E2,S→ε), A row (A→S,A→S,error), B row (B→S,B→S,E3), for lookaheads a,b,end-marker…
- GATE 2017 CS (CS2) Q16 – Which parser statements are correct? I: Canonical LR is more powerful than SLR. II: SLR is more powerful than LALR. III: SLR is more powerful than…
- GATE 2017 CS (CS2) Q42 – G has E→E−T T, T→T+F F, F→(E) id. Which equivalent grammar has no left recursion?
- GATE 2016 CS (CS2) Q55 – Which grammar has no left recursion?
- GATE 2016 CS (CS2) Q56 – Start symbol D and terminals int, ;, id, [, ], num generate one C-like array declaration with at least one dimension, such as int a[10][3];. G₁: D →…
- GATE 2014 CS (CS2) Q27 – Grammar: S → T * P; T → U T * U; P → Q + P Q; Q → Id; U → Id. Which is TRUE?
- GATE 2014 CS (CS1) Q44 – A canonical item set is S → L · > R and Q → R ·. On input symbol <, the set has .
- GATE 2017 CS (CS1) Q27 – Consider the following grammar: P xQRS Q yz z R w S y What is FOLLOW(Q)?
- GATE 2016 CS (CS1) Q55 – The attributes of three arithmetic operators in some programming language are given below. Operator Precedence Associativity Arity --- --- --- --- +…
- GATE 2015 CS (CS1) Q18 – Which one of the following is TRUE at any valid state in shift-reduce parsing?
- GATE 2018 CS Q48 – Consider the following parse tree for the expression a\#b36c36d\#e\#f, involving two binary operators 36 and `#`. Which one of the following is…
- GATE 2019 CS Q13 – Which one of the following kinds of derivation is used by LR parsers?
- GATE 2019 CS Q29 – Consider the grammar given below: S → Aa A → BD B → b ε D → d ε Let a, b, d, and 36 be indexed as follows: a b d 36 --- --- --- --- 3 2 1 0 Compute…
- GATE 2019 CS Q53 – Consider the augmented grammar given below: S' → S S → ⟨L⟩ id L → L,S S Let I 0=CLOSURE(\[S' S]\). The number of items in the set GOTO(I 0,) is:…
- GATE 2026 CS (CS2) Q41 – Consider canonical LR(0) parsing of the grammar below using terminals \a,b,c\ and non-terminals \A,B,C,S\, with S as the start symbol. S ACB A aA C cC…
- GATE 2026 CS (CS1) Q28 – Which of the following statements is/are true?
- GATE 2025 CS (CS2) Q40 – Given a Context-Free Grammar G as follows: S Aa bAc dc bda A d Which ONE of the following statements is TRUE?
- GATE 2025 CS (CS2) Q51 – Consider two grammars G 1 and G 2 with the production rules given below: G 1: S if\ E\ then\ S if\ E\ then\ S\ else\ S a E b G 2: S if\ E\ then\ S M M…
- GATE 2025 CS (CS1) Q46 – Which of the following statement(s) is/are TRUE while computing First and Follow during top down parsing by a compiler?
- GATE 2024 CS (CS2) Q40 – Consider the CFG with start symbol S and terminals a,b,c,d: S AaAb BbBa, A cS, B dS. In the partially-filled LL(1) table, S row has S→AaAb at a,…
- GATE 2024 CS (CS2) Q65 – Consider the augmented grammar parsed with an SLR parser, terminals \a,b,c,d,\#,@\: S' S; S SS Aa bAc Bc bBa; A d\#; B @. Let I 0=CLOSURE(\S' S\). The…
- GATE 2024 CS (CS1) Q26 – Which of the following is/are Bottom-Up Parser(s)?
- GATE 2024 CS (CS1) Q33 – Consider the operator precedence and associativity rules for the integer arithmetic operators given in the table: + (Highest, Left), - (High, Right),…
- GATE 2024 CS (CS1) Q38 – Consider grammar G with start symbol S: S→daT (1); T→aS bT (2); R→(3) ε. Terminals are a,b,c,d,f. FIRST(S)=c,d,f, FIRST(T)=a,b,ε, FIRST(R)=c,ε;…
- GATE 2022 CS Q13 – Which one of the following statements is TRUE?
- GATE 2022 CS Q29 – Consider the augmented grammar with \+, *, (, ), id\ as the set of terminals. S' S S S+R R R R*P P P (S) id If I 0 is the set of two LR(0) items \[S'…
- GATE 2021 CS (CS1) Q15 – Consider the following statements. S 1: Every SLR(1) grammar is unambiguous but there are certain unambiguous grammars that are not SLR(1). S 2: For…
- GATE 2021 CS (CS1) Q41 – Consider the following context-free grammar where the set of terminals is a, b, c, d, f. S -> d a T R f T -> a S b a T epsilon R -> c a T R epsilon…
- GATE 2020 CS Q34 – Consider the following grammar. S aSB d B b The number of reduction steps taken by a bottom-up parser while accepting the string aaadbbb is .