Let denote the languages generated by the grammar .
Which of the following is TRUE?
View worked solution
Answer: B
To find the language generated by the given grammar, let us derive a few strings:
- (length 2)
- (length 4)
- (length 6)
In general, each application of the rule adds one to the left and one to the right, increasing the length of the string by . The derivation terminates with the rule , which contributes two s.
Thus, the language generated is the set of all even-length strings of s:
Let us evaluate the options:
- Option A (): Incorrect. contains strings of odd length (e.g., ), which are not present in .
- Option B ( is regular but not ): Correct. Since can be represented by the regular expression , it is a regular language, and it is not equal to .
- Option C ( is context free but not regular): Incorrect. Every regular language is also context-free, but since is regular, the "not regular" part makes this statement false.
- Option D ( is not context free): Incorrect. Since is regular, it is also context-free.
Free practice · Your answers on this page are not saved.
