Computer Science EngineeringHardISRO SC
How many strings of length 8 over {a,b} contain no two consecutive a's?
- A. 55
- B. 56
- C. 53
- D. 248
Correct answer: A. 55
Counts follow f(n)=f(n-1)+f(n-2) with f(1)=2, f(2)=3, so f(8)=55.
Practise more Theory of Computation, Compilers & Digital Logic (ISRO CS) questionsTheory of Computation, Compilers & Digital Logic (ISRO CS): notes and key points
More Theory of Computation, Compilers & Digital Logic (ISRO CS) questions
- How many strings of length 9 over {a,b} contain bab as a substring?
- With the ambiguous grammar E -> E + E | E E | id, how many distinct parse trees does the string id + id id + id id + id id have?
- The grammar S -> aS | Sa | a is ambiguous. How many parse trees does a^5 have?
- For the dangling-else grammar S -> i S e S | i S | a (i = if, e = else, a = other statement), how many parse trees derive iiiaeaea?
- The CYK algorithm runs on a string of length 10 with a grammar in Chomsky normal form. Counting each (cell, split point) pair as one step…
- A grammar in Chomsky normal form derives a string of length 9. The number of derivation steps (rule applications) in any derivation is