Consider the following two statements:
2001
Consider the following two statements:

- A.
Only S1 is correct
- B.
Only S2 is correct
- C.
Both S1 and S2 are correct
- D.
None of S1 and S2 is correct
Attempted by 6 students.
Show answer & explanation
Correct answer: A
For S1: {02n | n ≥ 1}
This generates strings with an even number of zeros (length ≥ 2): L1 = {00, 0000, 000000, .....}.
Since it only requires checking if the count of $0$s is even or odd, it can be mapped by a simple regular expression
00(00)*or a 3-state Finite Automaton.Therefore, S1 is Regular.
For S2: {0m 1n 0m+n |m ≥ 1 and n ≥ 1}
Here, the number of trailing zeros must exactly equal the sum of the leading zeros (m) and intermediate ones (n).
A finite automaton has no memory to store or count arbitrarily large values of m and n to verify this matching condition later in the string. (It requires a stack, making it a Context-Free Language).
Therefore, S2 is Non-Regular.