GATE Computer ScienceVery hardGATE CSE
A DFA reads a binary string least-significant bit first (so the first symbol read is the 2⁰ bit) and must accept exactly the strings whose numeric value is divisible by 5 (leading/trailing zeros allowed). How many states does the minimal DFA have?
- A. 20
- B. 5
- C. 4
- D. 10
Correct answer: B. 5
The natural state is (value mod 5, 2^i mod 5), giving up to 20 pairs, but acceptance after any suffix x depends on r + p·x with p invertible mod 5, i.e. only on r·p⁻¹ mod 5; Moore refinement leaves exactly 5 classes.
More Theory of Computation questions
- How many strings of length at most 6 (the empty string included) over {a, b} belong to L(aba)?
- An ε-NFA over {a, b} has states 0–4, start 0, accepting state 4. Moves: 0 –ε→ 1; 0 –a→ {0,1}; 1 –b→ 2; 2 –ε→ 3; 3 –a→ {3,4}; 4 –b→ 2. How…
- A Mealy machine starts in S0. Transitions (state, input → next state / output): (S0,0 → S0/0), (S0,1 → S1/1), (S1,0 → S2/1), (S1,1 →…
- How many strings of length at most 5 over {0, 1} (the empty string included) contain the substring 00 and also have an even number of 1s?
- A grammar in Chomsky normal form generates a string of length 17. How many derivation steps (production applications) does any derivation…
- Consider the grammar S → aSb | bSa | SS | ε. How many strings of length exactly 8 does it generate?