Which of the following languages is regular?
View worked solution
Answer: C
To determine which language is regular, let us analyze each option:
- Option A: is the set of even-length palindromes. It requires a stack to match the symbols of with in reverse order, making it context-free but not regular.
- Option B: requires matching an arbitrary prefix followed by . Since the boundary between and is not fixed and requires memory, this language is not regular.
- Option C: . Let us simplify this expression:
- Since , its first symbol must be some . We can write for some .
- Then, .
- Substituting these into the expression gives:
- Since (length ), the middle portion is also a non-empty string in .
- Thus, any string in simply starts and ends with the same symbol ( or ) and has a non-empty middle part (total length ).
- Option D: is not regular for the same reason as Option B, as it requires matching a suffix of the form .
Free practice · Your answers on this page are not saved.
