GATE Computer ScienceHardGATE CS (PYQ pattern)
Which of the following languages is context-free?
- A. The complement of { w w : w ∈ {a, b}* }
- B. The language { w w : w ∈ {a, b}* } itself
- C. The language { aⁿbⁿcⁿ : n ≥ 0 } itself
- D. The language { aᵖ : p is a prime number }
Correct answer: A. The complement of { w w : w ∈ {a, b}* }
The complement of {ww} is context-free (a word is outside it iff its length is odd or it has positions i and i + n/2 with different symbols, which a PDA can guess), although {ww} itself is not: another proof that CFLs are not closed under complement.
More Theory of Computation questions
- Which of the following unary languages is NOT regular?
- Which one of the following statements is FALSE?
- Which regular expression denotes exactly the set of strings over {a, b} with an EVEN number of a's (zero included)?
- A DFA has 8 states. To decide whether the language it accepts is infinite, it suffices to check whether it accepts some string whose…
- Which of the following statements are correct? I. The reversal of a deterministic context-free language is always deterministic…
- Which of the following statements are correct? I. Recursively enumerable languages are closed under union and intersection. II…