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)?
| a | b | c | d | f | end-marker | |
|---|---|---|---|---|---|---|
| S | ① | S → d a T | ② | |||
| T | T → a S | T → b a T | ③ | T → ε | ④ | |
| R | R → c a TR | R → ε |
- (A) ① S → R f ② S → R f ③ T → ε ④ T → ε
- (B) ① blank ② S → R f ③ T → ε ④ T → ε
- (C) ① S → R f ② blank ③ blank ④ T → ε
- (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