GATE CS 2024 Set 1 | Question 38
Compiler Design › Parser · MCQ · 2 marks · Answer: A
- Question 38Compiler Designmcq2 marksGrammar with , , . Terminals . FIRST(S)=\{c,d,f\}, FIRST(T)=\{a,b,\}, FIRST(R)=\{c,\}, FOLLOW(S)=FOLLOW(T)=\{c,f,$\}, FOLLOW(R)=\{f\}. Which option correctly fills the productions?
- A.(1) (2) (3)✓
- B.(1) (2) (3)
- C.(1) (2) (3)
- D.(1) (2) (3)
Answer: A
Solution
Answer: (A) FIRST(S) must be : gives ; the other rule must contribute and . gives FIRST FIRST(R). So (1) . FIRST(T) contains , so is needed: (2) . FIRST(R) and gives FIRST (plus from the rule): (3) . This matches option (A). - A.
More GATE PYQ on Parser
All GATE CS Compiler Design PYQ →Attempt GATE CS 2024 Set 1 in real GATE exam mode
Full paper with a timer, the GATE interface and a topic-wise analysis — free.
Create free account →