GATE CS 2024 (Forenoon) — Question 38

Compiler DesignLexical Analysis & Parsing Architectures (LL(1), LR(1), LALR)MCQ2 marks · −2/3 if wrongMedium

Consider the following grammar \( G \), with \( S \) as the start symbol. The grammar \( G \) has three incomplete productions denoted by (1), (2), and (3). \( S \rightarrow daT \mid \) (1) \( T \rightarrow aS \mid bT \mid \) (2) \( R \rightarrow \) (3) \( \mid \epsilon \) The set of terminals is \( \{a, b, c, d, f\} \). The FIRST and FOLLOW sets of the different non-terminals are as follows. FIRST(\( S \)) = \( \{c, d, f\} \), FIRST(\( T \)) = \( \{a, b, \epsilon\} \), FIRST(\( R \)) = \( \{c, \epsilon\} \) FOLLOW(\( S \)) = FOLLOW(\( T \)) = \( \{c, f, \$\} \), FOLLOW(\( R \)) = \( \{f\} \) Which one of the following options CORRECTLY fills in the incomplete productions?
  1. A
    (1) \( S \rightarrow Rf \), (2) \( T \rightarrow \epsilon \), (3) \( R \rightarrow cTR \)
  2. B
    (1) \( S \rightarrow fR \), (2) \( T \rightarrow \epsilon \), (3) \( R \rightarrow cTR \)
  3. C
    (1) \( S \rightarrow fR \), (2) \( T \rightarrow cT \), (3) \( R \rightarrow cR \)
  4. D
    (1) \( S \rightarrow Rf \), (2) \( T \rightarrow cT \), (3) \( R \rightarrow cR \)
Practise the full 2024-FN paper
Challenge a friend: WhatsApp Telegram
From RENYXERAThis week's 10-question challengeSame 10 past-GATE questions for everyone this week — see where you stand.
Practise more on Lexical Analysis & Parsing Architectures (LL(1), LR(1), LALR)Timed, in the real exam interface · free to start

A GATE question every morning

One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.

Join
Stuck? Ask in the student group