GATE Computer ScienceHardGATE CSE · NIELIT
How many strings of length 8 does the grammar S → aSb | bSa | SS | ε generate?
- A. 56
- B. 70
- C. 80
- D. 76
Correct answer: B. 70
This grammar generates exactly the strings with equally many a's and b's, so the count is C(8,4) = 70.
More Theory of Computation questions
- Consider these statements. I. Deterministic context-free languages are closed under complementation. II. Deterministic context-free…
- For a Turing machine M given as input, how many of these properties are undecidable? (a) L(M) = ∅ (b) M has at least 5 states (c) L(M)…
- Which of the following languages over {0, 1} is regular?
- A single-tape TM (blank B) starts in q0 at the leftmost symbol of a binary string. Rules: δ(q0,0) = (q0,0,R); δ(q0,1) = (q0,1,R); δ(q0,B)…
- How many strings of length 10 over {a, b} have no three consecutive equal symbols (neither aaa nor bbb)?
- 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?