GATE Computer ScienceVery hardGATE CS
Let L = { w ∈ {a, b}* : (number of a's − number of b's) is divisible by 4 }. How many states does the minimal DFA for L have?
- A. 8
- B. 4
- C. 16
- D. 3
Correct answer: B. 4
Only the value (#a − #b) mod 4 matters: a adds 1 and b subtracts 1. All four residues are reachable and pairwise distinguishable (append aᵏ), so the minimal DFA has 4 states, not 16.
More Theory of Computation questions
- A grammar G in Chomsky Normal Form (no ε-production) generates a string w of length 9. How many derivation steps does any derivation of w…
- Let L = { w ∈ {a, b} : w contains at most 3 a's and at least 2 b's }. How many states does the minimal complete DFA for L have?
- Let #ab(w) and #ba(w) be the numbers of occurrences of the substrings ab and ba in w ∈ {a, b}. Which one of the following languages is…
- Let L = { w ∈ {a, b} : w begins with aba, or (w ends with b and na(w) ≡ 0 (mod 3)) }. The minimal complete DFAs for L and for its reversal…
- Consider the following claims about an arbitrary regular language L over Σ. I. { w : ww ∈ L } is regular. II. { w : w wᴿ ∈ L } is regular…
- Let D be a DFA and G a context-free grammar over the same alphabet. Consider the problems: I. Is L(D) ⊆ L(G)? II. Is L(G) ⊆ L(D)? III. Is…