StreakPeaked· Practice

ExamsGATETechnical

Language L1 is defined by the grammar: S1 → aS1b | ε Language L2 is defined by the grammar: S2 → abS2 | ε Consider the following statements: P: L1 is regular Q: L2 is regular Which one of the following is TRUE?

  1. Both P and Q are true
  2. P is true and Q is false
  3. P is false and Q is true
  4. Both P and Q are false

Correct answer: P is false and Q is true

Solution

L1 generates a^n b^n, which is not regular (requires matching counts, provable by pumping lemma). L2 generates (ab)^n = (ab)*, which is regular. So P is false and Q is true.

Related GATE Technical questions

⚔️ Practice GATE Technical free + battle 1v1 →