GATE Computer ScienceModerateGATE CS
A grammar G in Chomsky Normal Form (no ε-production) generates a string w of length 9. How many derivation steps does any derivation of w use?
- A. 16
- B. 18
- C. 9
- D. 17
Correct answer: D. 17
Each binary rule A → BC adds one symbol to the sentential form and there are n − 1 = 8 of them to reach 9 variables; then 9 terminal rules A → a convert them. Total 8 + 9 = 2n − 1 = 17.
More Theory of Computation questions
- Let L = { w ∈ {a, b} : w contains at most 3 a's and at least 2 b's }. How many states does the minimal complete DFA for L have?
- Let #ab(w) and #ba(w) be the numbers of occurrences of the substrings ab and ba in w ∈ {a, b}. Which one of the following languages is…
- Let L = { w ∈ {a, b} : w begins with aba, or (w ends with b and na(w) ≡ 0 (mod 3)) }. The minimal complete DFAs for L and for its reversal…
- Consider the following claims about an arbitrary regular language L over Σ. I. { w : ww ∈ L } is regular. II. { w : w wᴿ ∈ L } is regular…
- Let D be a DFA and G a context-free grammar over the same alphabet. Consider the problems: I. Is L(D) ⊆ L(G)? II. Is L(G) ⊆ L(D)? III. Is…
- A single-tape Turing machine has blank B and starts in q0 on the leftmost cell of a binary numeral (MSB at the left). Rules: δ(q0,0) =…