GATE Computer ScienceHardGATE CS (PYQ pattern)
To prove by the pumping lemma for context-free languages that L = { w w : w ∈ {a, b}* } is not context-free, which string (p is the pumping length) gives a valid contradiction?
- A. aᵖbaᵖb
- B. (ab)ᵖ(ab)ᵖ
- C. a²ᵖ
- D. aᵖbᵖaᵖbᵖ
Correct answer: D. aᵖbᵖaᵖbᵖ
Any window vxy of length ≤ p in aᵖbᵖaᵖbᵖ lies within two adjacent blocks, and pumping breaks the ww structure. With aᵖbaᵖb the window can contain the last a of the first half and the first a of the second half, so pumping both keeps the string of the form ww; (ab)²ᵖ and a²ᵖ are in L but can be pumped inside.
More Theory of Computation questions
- Which of the following statements are correct? I. Every regular language has an unambiguous context-free grammar. II. Every context-free…
- Rice's theorem cannot be applied directly to which of the following properties of a Turing machine M (although some of them are…
- If a language L and its complement are both recursively enumerable, then L is
- Which of the following classes of languages is closed under complement but NOT under union?
- Consider L = { aⁿbⁿ : n ≥ 0 } ∪ { aⁿb²ⁿ : n ≥ 0 }. Which classification is correct?
- Over the alphabet {a, b, c}, what is the status of the complement of { aⁿbⁿcⁿ : n ≥ 0 }?