Decidability & Computability

Answer & solution
Official answer: D
The overbars in statements 2–4 are essential: each asks about the complement of L. Regular languages are closed under complementation (complete a DFA and exchange accepting/nonaccepting states), and recursive languages are closed under complementation (swap the outcomes of a halting decider), so 3 and 4 always answer yes. Whether an arbitrary program ever outputs is undecidable by simulating a machine and printing only if it halts. For a context-free input language, deciding whether its complement is context-free is an undecidable grammar-property problem; lack of closure alone would not suffice to prove undecidability. Thus the intended decidable entries are 3 and 4, D. For a reduction justifying statement 2, fix a CFL H over a separate alphabet Γ whose complement is the non-CFL {ak bk ck: k≥0}; H is context-free by expressing unequal counts and malformed strings as a union of CFLs. Given a CFG language L over Σ, construct the CFL K consisting of L#Γ*, Σ*#H, and all malformed strings outside Σ*#Γ*. Its complement is (Σ*−L)#(Γ*−H). If L=Σ*, this is empty and context-free. Otherwise, choosing w∉L and intersecting with regular w#Γ* leaves w#(Γ*−H), which is not context-free (remove the fixed prefix by left quotient). Therefore a test for context-freeness of complements would decide the undecidable CFG-universality problem.
Check: A closure fact gives a constant yes-answer for promises 3 and 4, hence a decider exists. For promise 2, nonclosure alone merely says some answers are no; the reduction is necessary to establish that no algorithm can decide all such instances.