StreakPeaked· Practice

ExamsGATETechnical

Consider the following languages: L1 = {aⁿ b^m c^(n+m): m,n ≥ 1} L2 = {aⁿ bⁿ c^(2n): n ≥ 1} Which one of the following is TRUE?

  1. Both L1 and L2 are context-free.
  2. L1 is context-free while L2 is not context-free.
  3. L2 is context-free while L1 is not context-free.
  4. Neither L1 nor L2 is context-free.

Correct answer: Both L1 and L2 are context-free.

Solution

Both languages L1 and L2 can be generated by context-free grammars, as they can be described by rules that allow for the correct counting and arrangement of symbols, thus satisfying the properties of context-free languages.

Related GATE Technical questions

⚔️ Practice GATE Technical free + battle 1v1 →