Question

Consider the following two languages over the alphabet {a,b,c}\{a, b, c\}, where mm and nn are natural numbers.

L1={ambmcm+n∣m,n≥1}L_1 = \{a^m b^m c^{m+n} \mid m, n \ge 1\}
L2={ambncm+n∣m,n≥1}L_2 = \{a^m b^n c^{m+n} \mid m, n \ge 1\}

Which ONE of the following statements is CORRECT?

Choose one option
Official answer and solution
Official answer
C
From
Official GATE 2025 answer key

Solution

Rewrite the exponent m+nm+n of cc and check whether a single stack can verify the constraints.

  1. Analysis of L1L_1:
    • L1={ambmck∣m≥1,  k>m}L_1 = \{a^m b^m c^k \mid m \ge 1,\; k > m\} requires simultaneously checking that the number of aa's equals the number of bb's and that the number of cc's is strictly greater than mm. A single-stack PDA loses the count mm once it pops the aa's against the bb's, so L1L_1 is not a context-free language.
  2. Analysis of L2L_2:
    • We can rewrite L2={ambncncm∣m,n≥1}L_2 = \{a^m b^n c^n c^m \mid m, n \ge 1\}.
    • A PDA can push all mm aa's onto the stack, then push all nn bb's onto the stack, then pop the nn bb's against the first nn cc's, and finally pop the mm aa's against the remaining mm cc's (generated by the CFG S→aSc∣aAc,  A→bAc∣bcS \to aSc \mid aAc, \; A \to bAc \mid bc). Thus L2L_2 is a context-free language.
Final answer

Option (C)

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2025 Computer Science and Information Technology - Session 1 (CS1)
Question
45 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.