Skip to content
Official PYQ · 2012

GATE CS 2012 Q24 — Undecidability

Explain with AI

Which of the following problems are decidable?

  1. Does a given program ever produce an output?
  2. If LL is a context-free language, then, is Lˉ\bar{L} also context-free?
  3. If LL is a regular language, then, is Lˉ\bar{L} also regular?
  4. If LL is a recursive language, then, is Lˉ\bar{L} also recursive?
Choose one option
View worked solution

Answer: D

A problem is decidable if there exists an algorithm (a Turing machine that halts on all inputs) that can correctly answer "Yes" or "No" for every instance of the problem.

Let us analyze each statement:

  1. Does a given program ever produce an output?

    This is a variation of the Halting Problem. Determining whether an arbitrary program produces any output on some input is undecidable (by Rice's Theorem, as it is a non-trivial semantic property of the program).

  2. If LL is a context-free language, then, is Lˉ\bar{L} also context-free?

    Context-free languages (CFLs) are not closed under complementation. For a given CFL LL, its complement Lˉ\bar{L} may or may not be context-free. Deciding whether the complement of a given CFL is also context-free is an undecidable problem.

  3. If LL is a regular language, then, is Lˉ\bar{L} also regular?

    Regular languages are closed under complementation. Therefore, if LL is regular, Lˉ\bar{L} is always regular. Since the answer to this question is always "Yes" for any regular language LL, the decision problem is trivially decidable (the algorithm simply outputs "Yes").

  4. If LL is a recursive language, then, is Lˉ\bar{L} also recursive?

    Recursive (decidable) languages are closed under complementation. If LL is recursive, Lˉ\bar{L} is always recursive. Thus, the answer is always "Yes", making this problem trivially decidable.

Therefore, only problems 3 and 4 are decidable.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Undecidability questions