Let L denotes the language generated by the grammar S → 0S0 / 00. Which of the…
2000
Let L denotes the language generated by the grammar S → 0S0 / 00. Which of the following is true?
- A.
L = 0⁺
- B.
L is regular but not 0⁺
- C.
L is context free but not regular
- D.
L is not context free
Attempted by 12 students.
Show answer & explanation
Correct answer: B
The grammar S → 0S0 / 00 generates strings with an even number of zeros. Starting from S, applying S → 0S0 repeatedly adds pairs of zeros, while S → 00 terminates with two zeros. Thus, the language consists of strings like '00', '0000', etc., forming (00)+. This is a regular language but excludes odd-length strings of zeros.
A video solution is available for this question — log in and enroll to watch it.