GATE Computer ScienceHardGATE CSE · IBPS SO
How many strings of length 10 over {a, b} have no three consecutive equal symbols (neither aaa nor bbb)?
- A. 198
- B. 164
- C. 178
- D. 110
Correct answer: C. 178
Runs have length 1 or 2, so counts follow 2 × Fibonacci: length n gives 2F(n+1): lengths 1.. give 2, 4, 6, 10, 16, 26, 42, 68, 110, 178 → 178.
More Theory of Computation questions
- Over {a, b}, L = { w : w contains aab as a substring and |w| is odd }. What is the number of states in the minimal complete DFA for L?
- Decimal numerals are read most significant digit first (empty string = 0, leading zeros allowed). What is the number of states in the…
- Let L = { w ∈ {a, b} : the third symbol from the right end of w is a }; its minimal complete DFA has 8 states. How many states does the…
- Let L = { a^i b^j c^k : i ≠ j or j ≠ k, i, j, k ≥ 0 }. Which statement is correct?
- A DFA over {a, b} has states 0–3, start 0 and accepting state 3. Transitions: 0 –a→ 1, 0 –b→ 0; 1 –a→ 2, 1 –b→ 0; 2 –a→ 2, 2 –b→ 3; 3 –a→…
- A TM (blank B) has rules: δ(q0,a) = (q1,X,R); δ(q0,Y) = (q3,Y,R); δ(q0,B) = (qa,B,S); δ(q1,a) = (q1,a,R); δ(q1,Y) = (q1,Y,R); δ(q1,b) =…