CLR(1) Parser and LR(1) Items MCQs: 11 Solved Questions with Explanations

Attempt 11 CLR(1) and LR(1) item questions, then use the worked reasoning to separate parser hierarchy, grammar ambiguity, FIRST sets, and derivation order.

KnowledgeGate Team

Exam prep & CS education

Updated 12 Aug 20268 min read

Students often remember that CLR is powerful but lose marks when an LR(1) item's lookahead, grammar ambiguity, parser-family power, and rightmost derivation appear in the same set. Four decisions separate them: which parser family preserves the most lookahead, whether two FIRST sets share a terminal, whether one string has two derivations, and which derivation order a bottom-up parser rebuilds in reverse. The same ambiguity test recurs three times in two different letterings, so learn the shape rather than the letters.

CLR(1) parser and LR(1) items: the 90-second recall

An LR(1) item has the form [A → α · β, a]. The dot records how much of the production has been recognised, while a is the one lookahead terminal considered when a reduction becomes possible. In closure, [A → α · Bβ, a] adds [B → · γ, b] for every production B → γ and every b ∈ FIRST(βa).

Work one closure by hand. Take S' → S with S → C C and C → c C | d, and start from [S' → · S, $]. The dot sits before S, so closure adds [S → · C C, $]. In that item the dot sits before C with β = C and lookahead $, so the lookaheads for C come from FIRST(C$) = {c, d}, giving [C → · c C, c/d] and [C → · d, c/d]. Canonical LR keeps every state built this way separate; LALR merges states that share an LR(0) core, and that merge is what costs LALR the lookahead precision canonical LR pays a bigger table for.

Remember the containment SLR(1) ⊂ LALR(1) ⊂ canonical LR(1). Every LL(1) grammar is also LR(1), but LL(1) does not belong inside that SLR-to-LALR chain. The SLR, CLR and LALR parser comparison explains why preserving lookaheads changes parser power, while top-down and bottom-up parsing revises the shift-reduce picture.

For each question, hide the answer first. Decide whether it tests parser power, FIRST-set separation, ambiguity, derivation order, or tooling, then check the explanation.

CLR parser power and LR-family claims

Question 1: HPSC 2021

Find out the most powerful parsers.
A. SLR
B. LALR
C. Canonical LR
D. Operator-precedence

Answer: C. Canonical LR keeps distinct LR(1) states and their lookaheads. LALR merges states with the same LR(0) core, while SLR places reductions using FOLLOW sets. This comparison does not mean that CLR can parse an ambiguous grammar. Review Question 1 on its solved page.

Question 2: UGC NET December 2014

Which of the following is true ?
A. Canonical LR parser is LR (1) parser with single look ahead terminal
B. All LR(K) parsers with K > 1 can be transformed into LR(1) parsers.
C. Both (A) and (B)
D. None of the above

Answer: C. A canonical LR state contains LR(1) items, each with one terminal of lookahead. Finite-lookahead LR language classes can be represented with LR(1), sometimes after transforming the grammar. That does not mean an unchanged LR(k) table can simply discard k - 1 lookahead symbols. Review Question 2 on its solved page.

Question 3: UGC NET December 2012

Which of the following is the most powerful parsing method?
A. LL(1)
B. Canonical LR
C. SLR
D. LALR

Answer: B. Canonical LR preserves the most context among the listed methods. The trade-off is a larger state table. Review Question 3 on its solved page.

LL(1) versus LR(1) on actual grammars

Question 4: GATE 2015 Set 3

Consider the following grammar G:
    S → F | H
    F → p | c
    H → d | c
where S, F and H are non-terminal symbols and 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
A. Only S1
B. Only S2
C. Both S1 and S2
D. Neither S1 nor S2

Answer: D. FIRST(F) = {p, c} and FIRST(H) = {d, c}, so their intersection is {c}. On lookahead c, LL(1) cannot choose at S. Also, S ⇒ F ⇒ c and S ⇒ H ⇒ c, so the grammar is ambiguous. An LR(1) state would face competing completed reductions F → c · and H → c · on $. Review Question 4 on its solved page.

Question 5: GATE 2010

The grammar S → aSa | bS | c is
A. LL(1) but not LR(1)
B. LR(1) but not LL(1)
C. Both LL(1) and LR(1)
D. Neither LL(1) nor LR(1)

Answer: C. FIRST(aSa) = {a}, FIRST(bS) = {b}, and FIRST(c) = {c}. All three pairwise intersections are empty, so one lookahead selects a production. For example, S ⇒ bS ⇒ baSa ⇒ baca. Therefore the grammar is LL(1), and every LL(1) grammar is LR(1). Review Question 5 on its solved page.

Question 6: UGC NET December 2018

Consider the following grammar G:
    S → A | B
    A → a | c
    B → b | c
where {S, A, B} is the set of non-terminals and {a, b, c} is the set of terminals. Which of the following statement(s) is/are correct?
    S₁: LR(1) can parse all strings that are generated using grammar G
    S₂: LL(1) can parse all strings that are generated using grammar G
Choose the correct answer from the code given below:
A. Only S₁
B. Only S₂
C. Both S₁ and S₂
D. Neither S₁ nor S₂

Answer: D. FIRST(A) = {a, c} and FIRST(B) = {b, c}. Both S ⇒ A ⇒ c and S ⇒ B ⇒ c derive the same string, so the grammar is ambiguous and neither deterministic parser applies. Renaming the non-terminals of Question 4 from F, H to A, B leaves the two derivations of c untouched, so the answer does not move. Review Question 6 on its solved page.

Question 7: UGC NET December 2018

Consider the following grammar G:
    S → A | B
    A → a | c
    B → b | c
Where {S, A, B} is the set of non-terminals and {a, b, c} is the set of terminals. Which of the following statement(s) is/are correct?
    S₁: LR(1) can parse all strings that are generated using grammar G
    S₂: LL(1) can parse all strings that are generated using grammar G
Choose the correct answer:
A. Only S₁
B. Only S₂
C. Both S₁ and S₂
D. Neither S₁ nor S₂

Answer: D. Question 6 and this one are the same UGC NET December 2018 item in two slightly different transcriptions, so use it to check that your reasoning holds on a second reading. Both A ⇒ c and B ⇒ c, so the single string c has two derivations and the grammar is ambiguous. On the LR(1) side, after shifting c the parser sits in a state holding both completed items A → c · and B → c · with lookahead $, a reduce-reduce conflict that one symbol of lookahead cannot break. LL(1) fails earlier, because FIRST(A) and FIRST(B) both contain c. Review Question 7 on its solved page.

LR grammars, ambiguity and canonical derivations

Question 8: Coal India 2020

Which one of the following is true?
A. Every regular grammar is LL(1) and every regular set does not have an LR(1) grammar
B. Every regular grammar is not LL(1) and every regular set does not have an LR(1) grammar
C. Every regular grammar is LL(1) and every regular set has an LR(1) grammar
D. Every regular grammar is not LL(1) and every regular set has an LR(1) grammar

Answer: D. Every regular language has an LR(1) grammar, since every regular language is deterministic context-free. The paired claim reflects that some grammar presentations of regular languages are left-recursive and therefore not LL(1). Review Question 8 on its solved page.

Question 9: BEL Probationary Engineer 2023

Which derivation is also known as canonical derivations?
A. Left most derivation in reverse
B. Left most derivation
C. Right most derivation
D. Right most derivations in reverse

Answer: C. A rightmost derivation is conventionally called the canonical derivation. Remember that bottom-up parsing reconstructs a rightmost derivation in reverse. Review Question 9 on its solved page.

Question 10: UGC NET August 2016

Which of the following is FALSE ?
A. The grammar S → aS|aSbS|ε, where S is the only non-terminal symbol, and ε is the null string, is ambiguous.
B. An unambiguous grammar has same left most and right most derivation.
C. An ambiguous grammar can never be LR(k) for any k.
D. Recursive descent parser is a top-down parser.

Answer: B. An unambiguous grammar gives one parse tree, one leftmost derivation, and one rightmost derivation for a string. The two derivation sequences need not have the same sentential forms in the same order. A is an ambiguous grammar, C is true for deterministic LR(k), and recursive descent is top-down. Review Question 10 on its solved page.

Parser generators from BNF

Question 11: ISRO 2025

Which one of the following tools generates parser from BNF notation?
A. lex
B. yacc
C. ed
D. gdb

Answer: B. yacc consumes a BNF-like grammar and generates a parser. lex generates a lexical analyser from token patterns, ed is an editor, and gdb is a debugger. Review Question 11 on its solved page.

CLR(1) answer review: four checks to repeat

Question pattern

Check

Result

Parser power, Q1 and Q3

Compare listed parser families

Canonical LR

Shared FIRST terminal, Q4

FIRST(F) ∩ FIRST(H) = {c}

Neither LL(1) nor LR(1) for this ambiguous grammar

Disjoint FIRST sets, Q5

{a} ∩ {b} = ∅, {a} ∩ {c} = ∅, {b} ∩ {c} = ∅

LL(1), therefore LR(1)

BNF parser generator, Q11

Match tool to grammar input

yacc

Repeat this four-step method: compare FIRST sets for top-down choice; search for two derivations of one string before building an LR table; check whether LR(1) lookaheads are preserved or merged; and remember that bottom-up parsing reconstructs a rightmost derivation in reverse. Continue with the Compiler Design Parsing MCQs when you want a mixed set.

CLR(1) MCQs: the short version and next step

Canonical LR is the strongest of the standard LR methods here because it preserves separate LR(1) states and their lookaheads. Once one string has two derivations, as when two alternatives both derive c in Questions 4, 6 and 7, no amount of lookahead makes LL(1) or LR(1) deterministic, while pairwise disjoint FIRST sets settle LL(1) in one line. Use the GATE CS Exam Preparation category to place these ideas in the wider subject. If you want Compiler Design sequenced with the rest of GATE CS, GATE Guidance by Sanchit Sir is the structured next step.