GATE Computer ScienceHardGATE CS
Let L = { w ∈ {a, b}* : |w| ≡ 0 (mod 3) and w contains ab as a substring }. How many states does the minimal complete DFA for L have?
- A. 12
- B. 8
- C. 9
- D. 6
Correct answer: C. 9
Three phases (no a yet, an a seen but no ab, ab seen) times three residues of |w| mod 3 give 9 states, and all of them are distinguishable.
More Theory of Computation questions
- Over {a, b}, let L = { w : the number of a's in w is ≡ 1 (mod 3) and w ends with b }. How many states does the minimal complete DFA for L…
- How many strings of length 7 over {a, b} do not contain aa as a substring?
- Binary numerals are read most significant bit first (leading zeros allowed, the empty string counts as 0). What is the number of states in…
- An NFA over {a, b} has states 0, 1, 2, 3, start state 0 and accepting state 3. Transitions: δ(0,a) = {0,1}, δ(0,b) = {0}, δ(1,a) = δ(1,b)…
- How many strings of length 7 over {a, b} belong to the language of the regular expression (a + bb)(b + ε)?
- The grammar S → aSb | SS | ab generates how many distinct strings of length 6?