Skip to content
GATEiit

GATE CSE 2025 Session 2 Q40: Is the grammar S → Aa | bAc | dc | bda SLR(1) or LALR(1)?

Question

Given a Context-Free Grammar GG as follows:

S→Aa∣bAc∣dc∣bdaS \to Aa \mid bAc \mid dc \mid bda A→dA \to d

Which ONE of the following statements is TRUE?

Try it: multiple choice: exactly one correct option

Select one option
Wrong answer costs 2/3 mark in GATE.
Show answer and explanation

Answer: C (official GATE 2025 final answer key)

Concept used: SLR reduces on all of FOLLOW(A); LALR uses the precise lookaheads, which can remove shift-reduce conflicts.

First step: After reading dd from the start state, the items are S→d⋅cS \to d\cdot c and A→d⋅A \to d\cdot; compare FOLLOW(A)={a,c}(A) = \{a, c\} with the LR(1) lookahead aa.

Full step-by-step solution

Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.

Share this question

WhatsAppDownload image

Source: official GATE 2025 Session 2 CS question paper and final answer key, organised by IIT Roorkee. Question paper · Answer key