Question

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?

Choose every correct option
Official answer and solution
Official answer
A, C and D
From
Official GATE 2026 answer key

Solution

Test whether a single LIFO stack (PDA) can verify each constraint when reading aibjckdℓa^i b^j c^k d^\ell left to right.

Reading aibjckdℓa^i b^j c^k d^\ell in order:

  • (A) i+k=j+ℓ  ⟺  i−j=ℓ−ki + k = j + \ell \iff i - j = \ell - k: A PDA can push aa's, pop against bb's (maintaining ∣i−j∣|i - j| with a sign symbol), then push/pop cc's and match against dd's. Thus LL is context-free.
  • (B) i=ki = k and j=ℓj = \ell: This imposes crossing dependencies (aia^i with ckc^k, and bjb^j with dℓd^\ell). By the pumping lemma for CFLs, {aibjcidj}\{a^i b^j c^i d^j\} is not context-free.
  • (C) i=ℓi = \ell and j=kj = k: These are nested dependencies (S→aSd∣TS \rightarrow aSd \mid T, T→bTc∣ϵT \rightarrow bTc \mid \epsilon). A PDA pushes ii aa's, then pushes jj bb's, pops the jj bb's on reading ckc^k, and finally pops the ii aa's on reading dℓd^\ell. Thus LL is context-free.
  • (D) i+j=k+ℓi + j = k + \ell: A PDA simply pushes one symbol for each aa and each bb (i+ji + j symbols total), and pops one symbol for each cc and each dd (k+ℓk + \ell symbols total). Thus LL is context-free.
Final answer

Options (A), (C), (D)

Common trap

Assuming i+k=j+ℓi + k = j + \ell is not context-free without noticing it is a single linear equation over counts that a counter PDA can track.

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 2 (CS2)
Question
48 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.