GATE Computer ScienceVery hardGATE CS (PYQ pattern)
How many strings of length 6 over {a, b} match the regular expression (a + ab)*(b + ba)*?
- A. 46
- B. 34
- C. 41
- D. 32
Correct answer: C. 41
Enumerating all 64 strings of length 6 and testing each against the expression (the regex is ambiguous, so count strings, not matches) gives 41.
More Theory of Computation questions
- 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}…
- 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?