Question
Which one of the following is TRUE?
Official answer and solution
- Official answer
- C
- From
- Official GATE 2014 answer key
Solution
Evaluate each language against standard closure properties and automaton models for regularity.
Let us evaluate the four languages:
-
(A) : This requires counting and matching the number of 's and 's. A finite automaton cannot store arbitrarily large counts, so this is not regular (it is deterministic context-free).
-
(B) : The set of primes does not form an arithmetic progression. By the pumping lemma, this unary language is non-regular.
-
(C) : This condition requires the number of 's to be congruent to . A DFA with 3 states representing , with as start state and as the only accepting state, precisely recognizes this language. Therefore, this language is regular.
-
(D) : Recognizing the duplication of an arbitrary string requires unbounded memory to store , so this is not regular (in fact, not even context-free).
Thus, only statement C is TRUE.
C
Confusing counting modulo a constant (which is regular) with unbounded equality matching (which is not regular).
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2014 Computer Science and Information Technology (CS) Session 1
- Question
- 25 of 65, printed as CS Q.15
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.