GATE CS 2024, set 2 · Question 40 · Compiler Design · Multiple choice (MCQ) · 2 marks · −2/3 for a wrong answer

Consider the following context-free grammar where the start symbol is S and the set of terminals is {a,b,c,d}.
S → AaAb | BbBa ; A → cS | ε ; B → dS | ε
The following is a partially-filled LL(1) parsing table.
Which one of the following options represents the CORRECT combination for the numbered cells in the parsing table?
Note: In the options, “blank” denotes that the corresponding cell is empty.

abcd
SS → AaAbS → BbBa(1)(2)
AA → ε(3)A → cS
B(4)B → εB → dS
  1. (A) (1) S → AaAb (2) S → BbBa (3) A → ε (4) B → ε
  2. (B) (1) S → BbBa (2) S → AaAb (3) A → ε (4) B → ε
  3. (C) (1) S → AaAb (2) S → BbBa (3) blank (4) blank
  4. (D) (1) S → BbBa (2) S → AaAb (3) blank (4) blank
Answer

Answer (A)

Answer from the official GATE CS 2024 answer key.

The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes