GATE CS 2024 (Afternoon) — Question 40

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

Consider the following context-free grammar where the start symbol is S and the set of terminals is \( \{a, b, c, d\} \). \( S \rightarrow AaAb \mid BbBa \) \( A \rightarrow cS \mid \epsilon \) \( B \rightarrow dS \mid \epsilon \) The following is a partially-filled LL(1) parsing table.
Question image
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.
  1. A
    (1) \( S \rightarrow AaAb \) (2) \( S \rightarrow BbBa \) (3) \( A \rightarrow \epsilon \) (4) \( B \rightarrow \epsilon \)
  2. B
    (1) \( S \rightarrow BbBa \) (2) \( S \rightarrow AaAb \) (3) \( A \rightarrow \epsilon \) (4) \( B \rightarrow \epsilon \)
  3. C
    (1) \( S \rightarrow AaAb \) (2) \( S \rightarrow BbBa \) (3) blank (4) blank
  4. D
    (1) \( S \rightarrow BbBa \) (2) \( S \rightarrow AaAb \) (3) blank (4) blank
Practise the full 2024-AN paper
Challenge a friend: WhatsApp Telegram
Recommended book · affiliate linkCompilers: Principles, Techniques & ToolsThe "Dragon Book" for parsing, syntax-directed translation and code generation.
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