Let = {a, b, c, d} and let L = {ai bj ck d i, j, k, ≥ 0}. Which of the following constraints ensure(s) that the language L is context-free?
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2026 Set 2 · Q48
Time
Select all that applyOne or more correct
Solution
Official answer: A) i + k = j +; C) i = and j = k; D) i + j = k +
Context-Free Grammars and PDAsA language recognized by a Pushdown Automaton (PDA) is context-free.
Option (A): Constraint can be rewritten as . A PDA can push all 's onto the stack, pop for 's (or push remaining excess 's if ), then process 's and 's similarly to verify that the total net sum is zero. Hence, this language is context-free.
Option (B): contains cross-serial dependencies (matching with , and with ). Using the Pumping Lemma for Context-Free Languages with the string , it is easily shown that this language is not context-free.
Option (C): has nested dependencies. A PDA can push all 's, push all 's, match and pop the 's using 's, and then match and pop the 's using 's. Thus, it is context-free.
Option (D): . A PDA can push all symbols in the first group ('s and 's, total ) onto the stack, and then pop one symbol for each and (total ). Thus, this language is context-free.
Therefore, options A, C, and D are correct.
Try the question first, then check your work.
Examiner trap
Analyze whether the dependencies between the counts of symbols can be tracked using a single LIFO stack (nested or combined single-counter dependencies vs. interleaved/cross-serial dependencies).
This Context-Free Grammars and PDAs previous year question is Q48 of the GATE CSE 2026 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. 4 of them are 2-mark MSQs like this one, and GATE CSE 2026 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.