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.
| a | b | c | d | ||
|---|---|---|---|---|---|
| S | S → AaAb | S → BbBa | (1) | (2) | |
| A | A → ε | (3) | A → cS | ||
| B | (4) | B → ε | B → dS |
- (A) (1) S → AaAb (2) S → BbBa (3) A → ε (4) B → ε
- (B) (1) S → BbBa (2) S → AaAb (3) A → ε (4) B → ε
- (C) (1) S → AaAb (2) S → BbBa (3) blank (4) blank
- (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