GATE Computer ScienceHardGATE CSE · ISRO
How many strings of length at most 6 (the empty string included) over {a, b} belong to L(a*b*a*)?
- A. 55
- B. 72
- C. 127
- D. 63
Correct answer: D. 63
For length n the strings are those with at most one maximal block of b's: n(n+1)/2 + 1 of them (with n = 0 giving 1), summed over n = 0..6 gives 63.
More Theory of Computation questions
- An ε-NFA over {a, b} has states 0–4, start 0, accepting state 4. Moves: 0 –ε→ 1; 0 –a→ {0,1}; 1 –b→ 2; 2 –ε→ 3; 3 –a→ {3,4}; 4 –b→ 2. How…
- A Mealy machine starts in S0. Transitions (state, input → next state / output): (S0,0 → S0/0), (S0,1 → S1/1), (S1,0 → S2/1), (S1,1 →…
- How many strings of length at most 5 over {0, 1} (the empty string included) contain the substring 00 and also have an even number of 1s?
- A grammar in Chomsky normal form generates a string of length 17. How many derivation steps (production applications) does any derivation…
- Consider the grammar S → aSb | bSa | SS | ε. How many strings of length exactly 8 does it generate?
- For a Turing machine M given as input, which one of the following problems is decidable?