GATE Computer ScienceVery hardGATE CS (PYQ pattern)
What is the length of the shortest string over {a, b} that has length divisible by 4, contains both aab and bba, has an odd number of b's and ends with a?
- A. 4
- B. 8
- C. 12
- D. 6
Correct answer: B. 8
Search by length (multiples of 4 only): the first success is aaaabbba of length 8.
More Theory of Computation questions
- L₁ is the set of strings over {a, b} containing aa and L₂ the set containing bb. How many strings of length at most 6 lie in the symmetric…
- Let h be the homomorphism h(a) = 0, h(b) = 01. How many distinct strings of length exactly 10 are in the image h({a, b})?
- Which of the following decision problems can be solved by an algorithm that always halts?
- How many strings of length 10 over {a, b} contain aa as a substring but do not contain bb?
- How many strings of length exactly 9 are generated by the grammar S → aSbb | bSaa | SS | ε?
- Let L be the set of binary strings of length at least 3 whose third symbol from the right end is 1. What is the number of states in the…