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

Consider the following context-free grammar where the set of terminals is {a, b, c, d, f}.
S → d a T | R f ; T → a S | b a T | ε ; R → c a T R | ε
The following is a partially-filled LL(1) parsing table.
Which one of the following choices represents the correct combination for the numbered cells in the parsing table ("blank" denotes that the corresponding cell is empty)?

abcdfend-marker
S①S → d a T②
TT → a ST → b a T③T → ε④
RR → c a TRR → ε
  1. (A) ① S → R f ② S → R f ③ T → ε ④ T → ε
  2. (B) ① blank ② S → R f ③ T → ε ④ T → ε
  3. (C) ① S → R f ② blank ③ blank ④ T → ε
  4. (D) ① blank ② S → R f ③ blank ④ blank
Answer

Answer (A)

Answer from the official GATE CS 2021 answer key.

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