GATE Computer ScienceVery hardGATE CS (PYQ pattern)
Let L = { w ∈ {a, b}* : n_a(w) = 2·n_b(w) }. The prefix language Pref(L) = { x : xy ∈ L for some y }. How many states does the minimal complete DFA for Pref(L) have?
- A. 1
- B. 3
- C. 2
- D. Pref(L) is not regular
Correct answer: A. 1
L is not regular, but every x is a prefix of some member: if d = n_a − 2n_b > 0 append ⌈d/2⌉ b's and, if d is odd, one a first; if d ≤ 0 append −d a's. So Pref(L) = Σ*, accepted by a single accepting state.
More Theory of Computation questions
- Let L = (a + b)abb. The right quotient L / b = { w : wb ∈ L } has a minimal complete DFA with how many states?
- Let L = (a + b)abb. The left quotient a⁻¹L = { w : aw ∈ L } has a minimal complete DFA with how many states?
- Let L be the set of binary strings (MSB first, ε counted as 0 and accepted) whose value is divisible by 3; its minimal DFA has 3 states…
- Let L = { binary strings (MSB first, ε accepted) whose value is divisible by 5 }, with a minimal DFA of 5 states. For h(a) = 1 and h(b) =…
- Let L₁ = { w ∈ {a, b} : |w| ≡ 0 (mod 4) } and L₂ = { w : (na − nb) ≡ 0 (mod 4) }. The minimal complete DFA for L₁ ∪ L₂ has how many…
- Let L₁ = { w ∈ {a, b} : na(w) ≡ 0 (mod 4) } and L₂ = { w : |w| ≡ 0 (mod 6) }. The minimal complete DFA for L₁ ∩ L₂ has how many states?