Correct answer: (B) $E \to E + E \mid E * E \mid id$; (C) $S \to aS \mid Sa \mid \epsilon$
Explanation
Grammar (B) is the standard ambiguous expression grammar because strings like `id+id*id` have multiple parse trees. Grammar (C) is also ambiguous because the string `a` can be derived as $aS \Rightarrow a\epsilon$ or as $Sa \Rightarrow \epsilon a$. Grammar (A) generates balanced strings of the form $a^n b^n$ unambiguously, and grammar (D) generates $a^{*}$ unambiguously. Therefore, the ambiguous grammars are (B) and (C).
More Context-Free Grammars and Pushdown Automata questions
GATE 2026 CS (CS2) Q48– Let =\a,b,c,d\ and let L=\ai bj ck dl i,j,k,l 0\. Which of the following constraints…
GATE 2025 CS (CS1) Q19– Consider the following context-free grammar G, where S, A, and B are the variables…
GATE 2024 CS (CS1) Q59– Let G=(V,,S,P) be a context-free grammar in Chomsky Normal Form with =\a,b,c\ and V…
GATE 2024 CS (CS2) Q52– Consider a context-free grammar G with rules S aS, S aSbS, S c. Let w L(G) and let n a(w),…
GATE 2023 CS Q39– Consider the context-free grammar G below: S → aSb X; X → aX Xb a b, where S and X are…
GATE 2023 CS Q40– Consider the pushdown automaton (PDA) P below, which runs on the input alphabet a, b, has…