Skip to content
Official PYQ · 2001

GATE CS 2001 Q1.4 — Regular and Context-free Languages

Explain with AI

Consider the following two statements:

S1:{02n∣n≥1}S_1: \left\{ 0^{2n} \mid n \geq 1 \right\} is a regular language

S2:{0m1n0m+n∣m≥1 and n≥1}S_2: \left\{0^m1^n0^{m+n} \mid m \geq 1 \text{ and } n \geq 1 \right\} is a regular language

Which of the following statement is correct?

Choose one option
View worked solution

Answer: A

To determine the correctness of the statements, let us analyze each language individually:

  1. Statement S1S_1: L1={02n∣n≥1}L_1 = \left\{ 0^{2n} \mid n \geq 1 \right\}

    This language contains strings of 00s of even length (excluding the empty string): L1={00,0000,000000,… }L_1 = \{00, 0000, 000000, \dots\}. We can easily represent this language using the regular expression (00)+. Since a regular expression exists, L1L_1 is a regular language. Thus, S1S_1 is correct.

  2. Statement S2S_2: L2={0m1n0m+n∣m≥1 and n≥1}L_2 = \left\{0^m1^n0^{m+n} \mid m \geq 1 \text{ and } n \geq 1 \right\}

    In this language, the number of trailing 00s must equal the sum of the leading 00s and the middle 11s. This requires matching and counting across non-adjacent blocks, which cannot be done with a finite automaton (finite memory). Using the pumping lemma, we can easily show that L2L_2 is not regular (it is a context-free language). Thus, S2S_2 is incorrect.

Therefore, only statement S1S_1 is correct.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Regular and Context-free Languages questions