GateAI
Context-Free Grammars and PDAs

GATE CSE 2026 Set 2 · Q48

MSQ2 marksMedium

Time

Let Σ={a,b,c,d}\Sigma = \{a, b, c, d\} and let L={aibjckdℓ∣i,j,k,ℓ≥0}L = \{a^i b^j c^k d^\ell \mid i, j, k, \ell \ge 0\}. Which of the following constraints ensure(s) that the language LL is context-free?

Select all that applyOne or more correct

Pick every correct option

Solution

Step-by-step verified solution

Official answer: A) i + k = j +; C) i = and j = k; D) i + j = k +

Context-Free Grammars and PDAs

A language recognized by a Pushdown Automaton (PDA) is context-free.

  • Option (A): Constraint i+k=j+ℓi + k = j + \ell can be rewritten as (i−j)+(k−ℓ)=0(i - j) + (k - \ell) = 0. A PDA can push all aa's onto the stack, pop for bb's (or push remaining excess bb's if j>ij > i), then process cc's and dd's similarly to verify that the total net sum is zero. Hence, this language is context-free.

  • Option (B): L={aibjcidj∣i,j≥0}L = \{a^i b^j c^i d^j \mid i, j \ge 0\} contains cross-serial dependencies (matching aa with cc, and bb with dd). Using the Pumping Lemma for Context-Free Languages with the string z=anbncndnz = a^n b^n c^n d^n, it is easily shown that this language is not context-free.

  • Option (C): L={aibjcjdi∣i,j≥0}L = \{a^i b^j c^j d^i \mid i, j \ge 0\} has nested dependencies. A PDA can push all aa's, push all bb's, match and pop the bb's using cc's, and then match and pop the aa's using dd's. Thus, it is context-free.

  • Option (D): L={aibjckdℓ∣i+j=k+ℓ}L = \{a^i b^j c^k d^\ell \mid i + j = k + \ell\}. A PDA can push all symbols in the first group (aa's and bb's, total i+ji + j) onto the stack, and then pop one symbol for each cc and dd (total k+ℓk + \ell). Thus, this language is context-free.

Therefore, options A, C, and D are correct.

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

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

Where do you stand for GATE?

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.

One GATE CSE PYQ every morning

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 in GATE CSE

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 PDAs

More from GATE CSE 2026 Set 2

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2026 Set 2 · Q48 · MSQ

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

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.