GATE Computer ScienceVery hardGATE CS (PYQ pattern)
An NFA over {a, b} has states 0, 1, 2, 3, start state 0 and accepting set {2,3}. Transitions: δ(0): a→{2}, b→{0,2,3}; δ(1): a→{0,1,2}, b→∅; δ(2): a→∅, b→{2,3}; δ(3): a→{0}, b→{1}. How many of the 32 strings of length 5 over {a, b} does it accept?
- A. 24
- B. 20
- C. 17
- D. 16
Correct answer: B. 20
Convert to a DFA (subset construction with ε-closure) and run all 32 strings of length 5: 20 end in an accepting subset. Counting accepting paths instead of strings would overcount.
More Theory of Computation questions
- An NFA over {a, b} has states 0, 1, 2, 3, start state 0 and accepting set {1}. Transitions: δ(0): a→{0,1}, b→{1}; δ(1): a→{0,1,2,3}, b→∅…
- An ε-NFA over {a, b} has states 0, 1, 2, 3, start state 0 and accepting set {0,3}. Transitions: δ(0): a→{1,2}, b→{3}, ε→∅; δ(1): a→{2}…
- How many states does the minimal complete DFA have for the set of strings over {a, b} that begin with ab OR end with ab?
- How many states does the minimal complete DFA for the set of strings over {a, b} that end with abb have?
- Let L = { w ∈ {a, b} : na(w) is divisible by 3 }. How many states does the minimal complete DFA for the concatenation L·L have?
- How many states does the minimal complete DFA have for { w ∈ {a, b} : w contains exactly two a's OR exactly two b's }?