Question
Consider the following grammar where is the start symbol, and and are terminal symbols.
Which of the following statements is/are true?
Official answer and solution
- Official answer
- A, B and C
- From
- Official GATE 2026 answer key
Solution
Test derivations of and under the given CFG and recall that every CFL is decidable.
- Options (A) and (B) are true: The string has two distinct leftmost derivations (and two distinct parse trees):
- (where the first derives and the second derives via )
- (where the first derives via and the second derives )
Hence has two distinct derivations and the grammar is ambiguous.
- Option (C) is true: Every application of introduces one and one , while introduces an extra . Since has two 's and two 's, the production can never be used in deriving . Restricting to (the unambiguous Dyck grammar), has a unique parse tree and therefore only one rightmost derivation:
- Option (D) is false: Every context-free language is decidable.
Final answer
Options (A), (B), (C)
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2026 Computer Science and Information Technology - Session 1 (CS1)
- Question
- 25 of 65
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.