GATE Computer ScienceModerateGATE CS (PYQ pattern)
The language generated by S → TT, T → aTb | ε is
- A. { aⁿbⁿaᵐbᵐ : n, m ≥ 0 }
- B. { aⁿbⁿaⁿbⁿ : n ≥ 0 }
- C. { aⁿbᵐaⁿbᵐ : n, m ≥ 0 }
- D. { (aⁿbⁿ)* : concatenations of any number of blocks aⁿbⁿ }
Correct answer: A. { aⁿbⁿaᵐbᵐ : n, m ≥ 0 }
Each T independently produces aⁿbⁿ, so two independent blocks give aⁿbⁿaᵐbᵐ with n and m unrelated. Three or more blocks cannot occur (not a star), and equality of n with m is not enforced.
More Theory of Computation questions
- How many strings of length at most 6 are generated by S → aSa | bSb | aa | b?
- The following grammars all generate subsets of {a, b}, with S as the start symbol. Exactly one of the four grammars is unambiguous; which…
- Parser generators reject ambiguous grammars. Consider these CFGs (start symbol S). Exactly one of the four grammars is ambiguous; which one?
- Each option is a CFG over {a, b} with start symbol S. Exactly one of the four grammars is ambiguous; which one?
- A PDA with start state q0, bottom symbol Z, input alphabet {a, b} and accepting state qf (acceptance by final state) has transitions…
- A PDA with start state q0 and bottom symbol Z accepts by EMPTY STACK. Its transitions (stack top written first) are: δ(q0, a, Z) = {(q0…