GATE CS 2025 (Afternoon) — Question 51

Compiler DesignLexical Analysis & Parsing Architectures (LL(1), LR(1), LALR)MSQ2 marksMedium

Consider two grammars \( G_1 \) and \( G_2 \) with the production rules given below: \( G_1 : S \rightarrow \text{if } E \text{ then } S \mid \text{if } E \text{ then } S \text{ else } S \mid a \) \( E \rightarrow b \) \( G_2 : S \rightarrow \text{if } E \text{ then } S \mid M \) \( M \rightarrow \text{if } E \text{ then } M \text{ else } S \mid c \) \( E \rightarrow b \) where if, then, else, a, b, c are the terminals. Which of the following option(s) is/are CORRECT?
  1. A
    \( G_1 \) is not \( LL(1) \) and \( G_2 \) is \( LL(1) \).
  2. B
    \( G_1 \) is \( LL(1) \) and \( G_2 \) is not \( LL(1) \).
  3. C
    \( G_1 \) and \( G_2 \) are not \( LL(1) \).
  4. D
    \( G_1 \) and \( G_2 \) are ambiguous.
Practise the full 2025-AN paper
Challenge a friend: WhatsApp Telegram
From RENYXERAPractise this subject in the exam simulatorTimed, GATE-style tests with analytics that find your weak topics.
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