GATE Computer ScienceHardGATE CS (PYQ pattern)
A DFA over {0, 1} reads a binary numeral MSB first (leading zeros allowed, ε has value 0) and accepts iff the value ≡ 3 (mod 8). How many states does the minimal DFA have?
- A. 8
- B. 4
- C. 3
- D. 9
Correct answer: B. 4
Value mod 8 is the last three bits, with missing high bits read as 0. So the DFA only follows progress towards the pattern 011, where the start already counts as having seen a 0 (hence 11 alone, value 3, is accepted). Classes: last bit 0 or ε (start); …01 or 1 alone; …011 or 11 alone (accepting); …111. These 4 are distinct, so 4 states, not 8 residues.
More Theory of Computation questions
- L = { w ∈ {a, b} : (na(w) − nb(w)) ≡ 0 (mod 3) and |w| is even }. How many states does the minimal complete DFA for L have?
- Let L = { w ∈ {a, b} : |w| ≥ 3 and the 3rd symbol from the right end equals the last symbol }. How many states does the minimal complete…
- L = { w ∈ {a, b} : the 5th symbol from the right is a AND the 3rd symbol from the right is b } (so |w| ≥ 5). How many states does the…
- L = { w ∈ {a, b} : the 4th symbol from the right is a, OR the 2nd symbol from the right is b }. How many ACCEPTING states does the minimal…
- How many states does the minimal complete DFA have for the set of ODD-length strings over {a, b} that contain neither aba nor bab as a…
- The minimal complete DFA for { w ∈ {a, b} : abab is a substring of w } has how many states?