GATE Computer ScienceModerateGATE CS (PYQ pattern)
Which of the following classes of languages is closed under complement but NOT under union?
- A. Regular languages
- B. Recursive (decidable) languages
- C. Deterministic context-free languages
- D. Context-free languages
Correct answer: C. Deterministic context-free languages
DCFLs are closed under complement, but { aⁱbʲcᵏ : i = j } ∪ { aⁱbʲcᵏ : j = k } (both DCFLs) is inherently ambiguous, hence not a DCFL. Regular and recursive languages are closed under both; CFLs are closed under union but not complement.
More Theory of Computation questions
- 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 }?
- Consider the language L of strings over {a, b} that contain both abab and bb as substrings, have na ≡ 1 (mod 3) and have an even number of…
- What is the length of the shortest string over {a, b} that has length divisible by 4, contains both aab and bba, has an odd number of b's…
- L₁ is the set of strings over {a, b} containing aa and L₂ the set containing bb. How many strings of length at most 6 lie in the symmetric…
- Let h be the homomorphism h(a) = 0, h(b) = 01. How many distinct strings of length exactly 10 are in the image h({a, b})?