chapter
    Bottom-Up and LR Parsing PYQs for GATE CS

    Solve 8+ Bottom-Up and LR Parsing previous year questions for GATE CS with answers and detailed solutions. Free sample questions below.

    Try a question

    Answer it here to see how it works. Nothing is recorded until you sign in.

    Question 1
    2026 Slot Set2 PYQ
    Consider the canonical parsing of the grammar below using terminals and non-terminals with as the start symbol.





    Which one of the following options gives the number of shift-reduce conflicts that will occur in the ACTION table?
    Question 2
    2025 Slot Set2 PYQ
    Given a Context-Free Grammar as follows:





    Which ONE of the following statements is TRUE?
    Question 3
    2024 Slot Set2 PYQ

    Consider the following augmented grammar, which is to be parsed with a SLR parser. The set of terminals is

    Let . The number of items in the set is __________

    Question 4
    2024 Slot Set1 PYQ

    Which of the following is/are Bottom-Up Parser(s)?

    Question 5
    2024 Slot Set1 PYQ
    Consider the operator precedence and associativity rules for the integer arithmetic operators given in the table below.

    Operator Precedence Associativity + Highest Left − High Right * Medium Right / Low Right
    The value of the expression as per the above rules is __________
    Question 6
    2022 PYQ

    Consider the augmented grammar with as the set of terminals.

    If is the set of two items , then contains exactly __________ items.

    Question 7
    2021 Slot Set2 PYQ
    Consider the following augmented grammar with as the set of terminals.









    Let . The number of items in the set is __________.
    Question 8
    2021 Slot Set1 PYQ
    Consider the following statements.

    Every SLR(1) grammar is unambiguous but there are certain unambiguous grammars that are not SLR(1).
    For any context-free grammar, there is a parser that takes at most time to parse a string of length .

    Which one of the following options is correct?
    Free preview ends here

    Login to view the complete previous-year questions and solutions

    Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.

    Why MastersUp

    Personalised first. High quality throughout.

    Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.

    Built around you, not around a syllabus PDF

    Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.

    Revision that hits your weak spots

    We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.

    Questions calibrated to the real exam

    Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.

    Notes written for recall, not for volume

    Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.

    One place for everything

    Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.

    Honest progress

    No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.

    Unlock the whole course

    Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.

    Bottom-Up and LR Parsing PYQs for GATE CS

    Solve 8+ Bottom-Up and LR Parsing previous year questions for GATE CS with answers and detailed solutions. Free sample questions below.

    Chapter Roadmap: Bottom-Up and LR Parsing

    Chapter Roadmap: Bottom-Up and LR Parsing

    Building the parse tree from leaves to root: rightmost derivation in reverse.

    Your Learning Journey

    1. Bottom-Up Parser Types and LR Grammar Classes

    The foundation. Understanding handle pruning, rightmost derivations in reverse, and the strict hierarchy of LR(0), SLR(1), LALR(1), and CLR(1) parsers.

    2. Operator Precedence and Shift-Reduce Parsing

    The mechanics. How shift-reduce parsing works in practice, identifying handles, and the specialized rules of operator precedence grammars.

    3. LR Item Closure and GOTO Computation

    The engine. Step-by-step construction of canonical collections of LR items, the CLOSURE operation, and the GOTO function that builds the parsing DFA.

    4. LR Parsing Conflicts and Grammar Ambiguity

    The resolution. Identifying shift-reduce and reduce-reduce conflicts, understanding why they occur, and techniques to resolve them or prove a grammar is not LR.

    Chapter Weightage: High. Expect 1 to 2 questions directly testing LR item construction, conflict identification, or grammar class hierarchy.

    Bottom-Up Parser Types and LR Grammar Classes

    Bottom-Up Parser Types and LR Grammar Classes

    Why this matters: Bottom-up parsing is the most powerful class of deterministic parsing. It forms the basis of almost all automatic parser generators (like YACC and Bison) used in real-world compilers.

    What you will learn here

    • The core concept of "handle pruning" and rightmost derivation in reverse
    • The meaning of the L, R, and k in LR(k) parsing
    • The strict hierarchy of LR grammar classes: LR(0), SLR(1), LALR(1), and CLR(1)
    • How lookahead power trades off with the number of parser states
    Chapter context: Parser Types and LR Classes → Shift-Reduce Mechanics → Item Closure and GOTO → Conflict Resolution

    Bottom-Up and LR Parsing: Solved Questions with Step-by-Step Explanations (8 Problems)

    Question 1 · Compiler Design · 2026_Set2 MCQ
    Consider the canonical parsing of the grammar below using terminals and non-terminals with as the start symbol.





    Which one of the following options gives the number of shift-reduce conflicts that will occur in the ACTION table?
    1. A.

      2

    2. B.

      3

    3. C.

      4

    4. D.

      5

    Question 2 · Compiler Design · 2025_Set2 MCQ
    Given a Context-Free Grammar as follows:





    Which ONE of the following statements is TRUE?
    1. A.

      is neither LALR(1) nor SLR(1)

    2. B.

      is CLR(1), not LALR(1)

    3. C.

      is LALR(1), not SLR(1)

    4. D.

      is LALR(1), also SLR(1)

    Question 3 · Compiler Design · 2024_Set2 NAT

    Consider the following augmented grammar, which is to be parsed with a SLR parser. The set of terminals is

    Let . The number of items in the set is __________

    Question 4 · Compiler Design · 2024_Set1 MSQ

    Which of the following is/are Bottom-Up Parser(s)?

    1. A.

      Shift-reduce Parser

    2. B.

      Predictive Parser

    3. C.

      LL(1) Parser

    4. D.

      LR Parser

    Question 5 · Compiler Design · 2024_Set1 NAT
    Consider the operator precedence and associativity rules for the integer arithmetic operators given in the table below.

    Operator Precedence Associativity + Highest Left − High Right * Medium Right / Low Right
    The value of the expression as per the above rules is __________
    Question 6 · Compiler Design · 2022 NAT

    Consider the augmented grammar with as the set of terminals.

    If is the set of two items , then contains exactly __________ items.

    Question 7 · Compiler Design · 2021_Set2 NAT
    Consider the following augmented grammar with as the set of terminals.









    Let . The number of items in the set is __________.
    Question 8 · Compiler Design · 2021_Set1 MCQ
    Consider the following statements.

    Every SLR(1) grammar is unambiguous but there are certain unambiguous grammars that are not SLR(1).
    For any context-free grammar, there is a parser that takes at most time to parse a string of length .

    Which one of the following options is correct?
    1. A.

      is true and is false

    2. B.

      is false and is true

    3. C.

      is true and is true

    4. D.

      is false and is false

    More previous year questions (pyqs) in this unit