Language L1 is defined by the grammar: S1 → aS1b Language L2 is defined by the grammar: S2 → abS2 Consider the following statements: P: L1 is regular Q: L2 is regular Which one of the following is TRUE?
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2016 Set 2 · Q17
Time
Select one answerSingle correct
Solution
Official answer: C) P is false and Q is true
Context-Free Grammars and PDAsLanguage : The production generates the language:
is a standard non-regular context-free language (it requires a stack to match the number of 's and 's). Therefore, statement is false.
Language : The production is a right-linear grammar that generates:
Since can be expressed by a regular expression , it is regular. Therefore, statement is true.
Hence, is false and is true, making (C) the correct option.
Try the question first, then check your work.
Examiner trap
Determine the set of strings generated by each grammar: one involves equal counts of matching symbols, while the other generates repeated occurrences of a fixed substring.
This Context-Free Grammars and PDAs previous year question is Q17 of the GATE CSE 2016 Set 2 paper. Find more GATE CSE PYQs on Context-Free Grammars and PDAs in Theory of Computation, or browse all GATE CSE PYQs.
Free diagnostic
Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Context-Free Grammars and PDAs PYQs now with no account.
An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.
Context-Free Grammars and PDAs has 26 GATE CSE PYQs across 17 papers from 2011 to 2026. 9 of them are 1-mark MCQs like this one, and GATE CSE 2016 Set 2 has 2.
How GATE tests Context-Free Grammars and PDAsIndependent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.