Language L₁ is defined by the grammar: S₁ → aS₁b | ε Language L₂ is defined by…

2007

Language L₁ is defined by the grammar:

S₁ → aS₁b | ε

Language L₂ is defined by the grammar:

S₂ → abS₂ | ε

Consider the following statements:

P: L₁ is regular

Q: L₂ is regular

Which one of the following is TRUE?

  1. A.

    Both P and Q are true

  2. B.

    P is true and Q is false

  3. C.

    P is false and Q is true

  4. D.

    Both P and Q are false

Attempted by 10 students.

Show answer & explanation

Correct answer: C

L₁ generates strings a^n b^n, which requires counting and is context-free, not regular. L₂ generates (ab)^n, equivalent to regex (ab)*, which is regular. Thus P is false and Q is true.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir