Consider the following languages:
Which of the languages are regular?
View worked solution
Answer: D
To determine which of the given languages are regular, let us analyze each one individually:
- : This language consists of duplicated strings. To recognize strings in , a machine must remember the first half of the string and compare it symbol-by-symbol with the second half in the exact same order. This requires infinite memory and cannot be done by a Finite Automaton (FA). In fact, is not even a Context-Free Language (CFL). Thus, is not regular.
- : This is the language of even-length palindromes. Recognizing requires matching symbols from the center outwards (in reverse order), which requires a stack (infinite memory). While it is a Context-Free Language, is not regular.
- : Since string lengths must be non-negative, we consider . This gives: This is the set of all strings of s with an even length. It can be represented by the regular expression and recognized by a simple 2-state DFA. Thus, is regular.
- : The lengths of the strings in this language are perfect squares: . The gap between consecutive string lengths () grows infinitely. By the Pumping Lemma, any regular language over a single-letter alphabet must have string lengths that eventually form an arithmetic progression (i.e., become periodic). Since the sequence of perfect squares is not periodic, is not regular.
Therefore, only is regular, which corresponds to option D.
Free practice · Your answers on this page are not saved.
