GATE Computer ScienceVery hardGATE CS (PYQ pattern)
How many strings of length 10 over {a, b} lie in the language of the regular expression a*b*a*b*?
- A. 130
- B. 176
- C. 56
- D. 386
Correct answer: B. 176
A string with r runs matches iff its run pattern fits into a, b, a, b: r ≤ 4 if it starts with a, r ≤ 3 if it starts with b. Strings of length 10 with r runs and a given first letter: C(9, r − 1). Start a: 1 + 9 + 36 + 84 = 130; start b: 1 + 9 + 36 = 46. Total 176.
More Theory of Computation questions
- The regular expression ((aa + bb)(ab + ba)) is over Σ = {a, b}. How many states does the minimal complete DFA for its language have?
- Exactly one of the following strings is NOT in the language of (a + ab)(b + ba). Which one?
- The regular expression a(bab)a is over Σ = {a, b}. How many states does the minimal complete DFA for its language have?
- The regular expression (a + b)(ab + ba)(a + b) is over Σ = {a, b}. How many states does the minimal complete DFA for its language have?
- Exactly one of the following strings is NOT in the language of (a + bb)(b + aa). Which one?
- The regular expression (a(ab)b) is over Σ = {a, b}. How many states does the minimal complete DFA for its language have?