Start learning →

Which language is REGULAR (recognised by some DFA)?

A$\{a^n b^n \mid n \geq 0\}$ (equal numbers of a's then b's)
B$\{w \in \{0,1\}^* \mid w \text{ contains an even number of 1's}\}$
C$\{a^p \mid p \text{ is prime}\}$
D$\{ww \mid w \in \{0,1\}^*\}$ (palindrome-like duplications)
Answer & Solution
Correct answer: B. $\{w \in \{0,1\}^* \mid w \text{ contains an even number of 1's}\}$
1. Regular languages are exactly those recognised by some DFA / NFA / regular expression. 2. Option B (even number of 1's): a 2-state DFA suffices. State 0 = even count of 1's so far (accepting), state 1 = odd. Reading 0 stays put; reading 1 toggles. Regular ✓. 3. Option A ($a^n b^n$): NOT regular. Any DFA has finite states, but to remember how many a's were read (to check the matching number of b's) requires unbounded memory. Pumping lemma confirms. 4. Option C (primes): NOT regular. Primes are not a regular set. 5. Option D (duplications $ww$): NOT regular. Needs unbounded memory to remember the first half. 6. Useful rule of thumb: if a language requires COUNTING or MATCHING unbounded structures, it's NOT regular. _Source: Jeff Erickson, "Models of Computation", §2.5 + §2.10 (Regular vs non-regular examples)._
Practise this question with Quill — GATE CSE →

Keep practising Theory of Computation

Browse all Theory of Computation questions for GATE CSE, or explore more Computer Science topics.

Start a Theory of Computation lesson →
Related questions