Theory of Computation · Decidability & Computability
43 questions, newest first
GATE CSE has asked 43 questions on Decidability & Computability (Theory of Computation) from 1994 to 2025, in 28 of the 46 papers; the most recent is in GATE CSE 2025 Set 2. In the last five years it carried 0.5 marks per 100-mark paper on average, against 1.3 since 2003. Since 2014 the questions have been 15 MCQ and 3 MSQ. 3 groups of questions here are solved the same way; “One per method” keeps the newest of each.
Given arbitrary context-free grammars G1,G2 and a regular expression R, which decision problem has an algorithm that always terminates with the correct yes/no answer? Options: A. L(G1)=L(G2)? B. L(G1)∩L(G2)=∅? C. L(G1)=L(R)? D. L(G1)=∅?
Your answer
Answer & solution
Official answer: D
CFG emptiness is decidable by identifying productive nonterminals, those that can derive a string containing only terminals. Start by marking a nonterminal with a production containing no nonterminals, including an epsilon production. Repeatedly mark the left side of a production whenever all nonterminals on its right side are already marked. Since there are finitely many nonterminals and marks are only added, this process terminates. The generated language is nonempty exactly when the start symbol is marked. Hence D is decidable.
General equivalence of two CFGs (A) and emptiness of the intersection of two CFLs (B) are undecidable. Do not infer B from single-CFG emptiness: CFLs are not closed under intersection, so there need not be an effectively constructed CFG for the intersection.
C is also undecidable in general despite one language being regular. If it were decidable, choose R to denote Σ*. It would then decide whether an arbitrary CFG generates every string over Σ, the undecidable CFG universality problem. The asymmetry matters: containment of a CFL in a regular language can be decided using intersection with a regular complement, but equality also requires the reverse containment. Answer: D.
Select true statements: A every subset of a recursively enumerable language is recursive; B if L and its complement are recursively enumerable, L is recursive; C the complement of a context-free language is recursive; D the intersection of two regular languages is deterministic context-free.
Select all that apply
Answer & solution
Official answer: B,C,D
A is false: a recursively enumerable language such as Σ* can have a subset that is not recursive. B is true because dovetailing recognizers for a language and its complement always finds one acceptance, giving a decider. C is true because CFL membership is decidable and decidable languages are closed under complement. D is true because a DPDA can track a regular-language DFA in its finite control without losing determinism. Thus B, C, D.
For B, alternate one step of each recognizer on the same input. Exactly one must eventually accept, so the procedure always halts with the correct yes/no result. For D, regular languages are closed under intersection using a product DFA; a deterministic PDA can simulate that DFA while ignoring its stack.
Select undecidable problems: A equality of languages of two given Turing machines; B whether a given TM language is regular; C whether a TM accepts all strings; D whether a given TM takes more than the fixed printed bound 1073 steps on every string.
Select all that apply
Answer & solution
Official answer: A,B,C
Turing-machine language equivalence, regularity, and universality are undecidable semantic properties: fix one machine to recognize Σ* for an equivalence-to-universality reduction, and apply Rice’s theorem to the other two nontrivial language properties. D asks about a fixed finite time bound, printed as 1073. Simulate on the finitely many distinguishable input prefixes/end-marker cases visible within that many steps. This decides whether every input runs longer than the bound; complexity is enormous but finiteness suffices. Thus A, B, C.
A language property is nontrivial when some recognizable languages possess it and others do not. Regularity and universality satisfy this requirement, so Rice applies. Runtime within a fixed number of steps is instead a bounded execution property: only finitely many tape cells can be inspected. An astronomical fixed bound remains finite and does not become the unbounded halting problem.
For Σ={0,1} and automaton encoding ⟨M⟩, select the languages that are NOT recursive. A {⟨M⟩: M is a DFA and L(M)=∅}; B {⟨M⟩: M is a DFA and L(M)=Σ*}; C {⟨M⟩: M is a PDA and L(M)=∅}; D {⟨M⟩: M is a PDA and L(M)=Σ*}.
Select all that apply
Answer & solution
Official answer: D
DFA emptiness is decidable by reachability of an accepting state. DFA universality is decidable by complementing the complete DFA and checking emptiness. PDA emptiness is decidable, for example by converting to a CFG and marking productive nonterminals. Universality of a general nondeterministic PDA/CFG is undecidable, so only D is not recursive.
A recursive language has an algorithm that halts on both yes and no instances. For DFA universality, first ensure the transition function is total by adding a sink if necessary, then invert final/nonfinal states and run a finite reachability test. PDA emptiness asks whether some derivation produces a terminal string, which productive-variable marking decides. PDA universality is a known undecidable CFG universality problem; enumerating accepted strings cannot certify that no unaccepted string exists.
For Turing-machine encodings ⟨M⟩, L1={⟨M⟩: M takes more than 2021 steps on all inputs}, L2={⟨M⟩: M takes more than 2021 steps on some input}. Which is correct? A both decidable; B L1 decidable/L2 undecidable; C L1 undecidable/L2 decidable; D both undecidable.
Your answer
Answer & solution
Official answer: A
A computation limited to 2021 steps can inspect only finitely many input positions. Enumerate all finite relevant prefixes, including end-of-input cases, and simulate M for that fixed bound on each representative. Check whether all representatives run longer than 2021 for L1, or at least one does for L2. Both procedures terminate, despite a very large finite enumeration. Therefore both languages are decidable, A.
This is bounded-time behavior, unlike the unbounded halting problem. In 2021 steps a standard single-tape input head can visit only a bounded initial portion of the input; choose a conservative prefix bound 2022 and include all shorter words and all words of that prefix length as representatives for longer inputs. Simulate each for exactly the fixed bound, detecting whether it halts within it. The enumeration is enormous but finite, which is sufficient for decidability; no practical polynomial-time claim is made.
S1 every infinite regular language contains an undecidable subset. S2 every finite language is regular. A only S1; B only S2; C both; D neither.
Your answer
Answer & solution
Official answer: C
Every infinite language over a finite alphabet is countably infinite and has uncountably many subsets, whereas only countably many algorithms, hence decidable languages, exist. At least one subset is therefore undecidable, proving S1. Every finite language has a regular expression formed by union of its finitely many words, proving S2. Thus C.
The counting argument is nonconstructive: it proves an undecidable subset exists without requiring the regular language itself to encode a difficult membership test. For a finite language {w1,…,wm}, regex w1+…+wm recognizes it; the empty language is regular too. Being a subset of a decidable language does not imply decidability.
Which languages of machine encodings are undecidable? L1={⟨M⟩:L(M)=∅}; L2={⟨M,w,q⟩:M on w reaches q in exactly 100 steps}; L3={⟨M⟩:L(M) is not recursive}; L4={⟨M⟩:L(M) has at least 21 members}. A L1,L3,L4; B L1,L3; C L2,L3; D L2,L3,L4.
Your answer
Answer & solution
Official answer: A
Worked explanation
Apply Rice’s theorem only to semantic properties of the recognized language that are neither true for every recognizable language nor false for all of them. Emptiness is nontrivial (∅ versus {ε}); nonrecursiveness is nontrivial (a recognizable undecidable language versus a finite language); at least 21 strings is nontrivial (∅ versus any 21-element finite language). Thus L1,L3,L4 qualify. L2 instead concerns a bounded computation trace. A simulator executes at most 100 transitions and checks q at the specified step, rejecting if the run ends earlier without that event. This always halts. An unbounded reachability question would be very different.
Derivation and answer
TM-language emptiness, being nonrecursive, and having at least 21 strings are each nontrivial semantic properties of recursively enumerable languages, so Rice’s theorem makes L1, L3, L4 undecidable. L2 is decidable by simulating the specified machine and input for exactly 100 steps and checking the state. Thus A.
Classify: I membership w∈L(G) for unrestricted G; II whether a TM language is regular; III equality of languages of two unrestricted/general grammars; IV whether an NFA language has an equivalent deterministic PDA. Options A only I,II undecidable; B only III; C only II,IV; D only I,II,III.
Your answer
Answer & solution
Official answer: D
Method
Rice’s theorem applies to nontrivial properties of the recognized language, not to arbitrary syntactic machine properties. Regularity is nontrivial because some recognizable languages are regular and some are not. Equivalence of general grammars includes comparing a grammar to one generating the empty language, already an undecidable emptiness problem. IV is different: every regular language has a DFA, and a deterministic PDA can simulate a DFA while leaving its stack unchanged. Therefore IV is a constant-yes decision problem.
Solution
I is the undecidable membership problem for unrestricted grammars/Turing-recognizable languages. II is a nontrivial semantic property of a TM language, hence undecidable by Rice’s theorem. III, equivalence of general grammars, is undecidable (even equivalence of CFGs is undecidable). IV always has answer yes: convert the NFA to a DFA and view that DFA as a DPDA that does not use its stack. Hence only I, II, III are undecidable, D. If III were restricted to regular grammars it would be decidable, but no such restriction is stated.
A,B are finite alphabets and # belongs to neither. f:A*→B* is total; computable means a Turing machine halts on every x with f(x) on tape. Lf={x#f(x):x∈A*}. A f computable iff Lf recursive; B f computable iff Lf recursively enumerable; C computability implies recursive graph but not conversely; D computability implies RE graph but not conversely. This is printed as a single-choice question.
Your answer
Answer & solution
Official answer: A
Our answer: A and B both valid for total f
1. If f is computable, first reject strings not of form x#y with x∈A*,y∈B*. Otherwise compute f(x), which halts by totality, and compare it with y. This is a decider for Lf, so the graph is recursive and hence RE.
2. Conversely suppose only an RE recognizer for Lf is available. List all y∈B* and simulate the recognizer on x#y in dovetailed rounds, giving every candidate increasingly many steps. Do not run one candidate to completion: a nonmember may loop forever.
3. Because f is total, one candidate y=f(x) exists and will eventually be accepted; function uniqueness ensures it is the right output. This procedure halts for every x and computes f. Thus an RE graph already suffices, and a recursive graph certainly suffices. Both A and B are mathematically true; the protected official single-choice answer A is retained, not treated as eliminating B.
Which problems are undecidable? I:given regular expression R and string w, test w∈L(R). II:given CFG G, test L(G)=∅. III:given CFG G over Σ, test L(G)=Σ*. IV:given Turing machine M and string w, test w∈L(M). A:I,IV. B:II,III. C:II,III,IV. D:III,IV.
Your answer
Answer & solution
Official answer: D
1. I is decidable: convert the regular expression to a finite automaton and simulate it on the finite input string. The simulation terminates after processing the input.
2. II is decidable: repeatedly mark CFG variables that can derive terminal strings, beginning with terminal-only or ε productions. Because there are finitely many variables the marking reaches a fixed point. The language is nonempty exactly when the start variable is marked.
3. III is the general CFG universality problem, which is undecidable. IV is Turing-machine acceptance, also undecidable: simulation may run forever on a rejected/nonaccepted input, so it is only a recognizer, not a decider. Thus the undecidable pair is III and IV, D. Do not confuse decidable CFG membership or emptiness with universality.
Which decision problems are undecidable? I: Given NFAs N1,N2, is L(N1) intersection L(N2) empty? II: Given CFG G and string x, is x in L(G)? III: Given CFGs G1,G2, are their languages equal? IV: Given Turing machine M, is L(M) empty? A: I,IV. B: II,III. C: III,IV. D: II,IV.
Your answer
Answer & solution
Official answer: C
NFA intersection emptiness is decidable by product-automaton reachability. CFG membership is decidable by parsing. Equivalence of arbitrary CFGs is undecidable, and TM-language emptiness is a nontrivial semantic property covered by Rice’s theorem. Thus III and IV, C.
For I, the product automaton accepts exactly the intersection, and finite graph search checks whether an accepting state is reachable. For II, a finite input can be handled by a terminating CFG parsing algorithm. Neither argument extends to III: comparing all words of two arbitrary CFGs is an undecidable equivalence problem. For IV, empty-language and nonempty-language Turing machines both exist, making emptiness a nontrivial property of recognized languages and hence undecidable by Rice's theorem.
X is recursive; Y is recursively enumerable but not recursive. There are computable many-one reductions complement(Y)≤m W and Z≤m complement(X). Which conclusion is correct? A:W can be recursively enumerable and Z is recursive. B:W can be recursive and Z is recursively enumerable. C:W is not recursively enumerable and Z is recursive. D:W is not recursively enumerable and Z is not recursive. The complement bars are part of the printed source, although plain PDF extraction omits them.
Your answer
Answer & solution
Official answer: C
The source has complement bars: complement(Y) reduces to W, and Z reduces to complement(X). Since Y is RE but not recursive, complement(Y) cannot be RE, otherwise dovetailing the two recognizers would decide Y. RE languages are closed under computable many-one preimages, so W cannot be RE. X recursive implies complement(X) recursive, and its computable preimage Z is recursive. Hence C.
The direction of the reduction is crucial. To recognize complement(Y) from a recognizer for W, compute the reduction image and run that recognizer. Thus if W were RE, complement(Y) would be RE, contradicting the fact that an RE language with an RE complement is decidable. For Z, compute its reduction image and run the decider for complement(X), which halts on all inputs. This closure argument proves Z recursive without assuming anything about its syntax or structure.
Let L1={⟨M⟩:M takes at least 2016 steps on some input}, L2={⟨M⟩:M takes at least 2016 steps on all inputs}, L3={⟨M⟩:M accepts ε}. Which are recursive? A only L1; B only L2; C L1 and L2 only; D all three.
Your answer
Answer & solution
Official answer: C
Whether a machine takes at least 2016 steps depends only on its first 2016-step computation prefix. In that time its input head can inspect only a bounded initial segment, so finitely many representative inputs suffice: all short inputs and one representative extension for each sufficiently long prefix. Simulate each for the fixed bound and test whether any (L1) or every (L2) representative survives that many steps. Both tests halt. Acceptance of epsilon (L3) is undecidable by the standard reduction that builds a machine ignoring its input and simulating an arbitrary machine/input pair. Hence C.
The constant 2016 is essential: this is bounded simulation, not the general halting problem. A machine cannot inspect arbitrarily far into its input in a fixed number of steps. For L3, given M,w, construct N that ignores its own input and simulates M on w, accepting iff M accepts w. Deciding whether N accepts ε would decide the undecidable acceptance problem.
Assess I complement of every decidable language is decidable; II some language is in NP but undecidable; III every NP language is decidable. A II only; B III only; C I and II; D I and III.
Your answer
Answer & solution
Official answer: D
A decider halts on every input, so exchanging accept and reject decides the complement. An NP computation has a finite polynomially bounded certificate/search tree, which a deterministic machine can exhaust, so every NP language is decidable. I and III hold, II fails: D.
A language in NP has a polynomially bounded certificate verifier. A deterministic decider can enumerate every certificate up to that finite bound and run the verifier, halting with yes if one works and no otherwise. This may be exponential but still terminates, so III is true and II is false. A decider for a complement simply reverses the yes/no outcomes of a halting decider, so I is also true. Distinguish decidability from efficient decidability.
Let L̅ be the complement of language L. Which situation is impossible? A: Neither L nor L̅ is recursively enumerable (r.e.). B: One is r.e. but nonrecursive and the other is not r.e. C: Both are r.e. but nonrecursive. D: Both are recursive.
Your answer
Answer & solution
Official answer: C
1. Method and setup. A recognizer may loop forever on a nonmember, whereas a decider must halt on every input. If recognizers exist for both complementary sides, simulate their steps alternately. Every input belongs to exactly one side, so one simulation eventually accepts, allowing a halting membership decision.
2. Work through the result and its assumptions. If both a language and its complement have recognizers, dovetail them on the input; exactly one eventually accepts, deciding membership. Both would therefore be recursive. Hence both being r.e. but nonrecursive is impossible, C. The other possibilities occur, including non-r.e./non-co-r.e. languages.
Write A≤mB for a computable many-to-one reduction from language A to B. Which claim is false? A If A≤mB and B is recursive, A is recursive. B If A≤mB and A is undecidable, B is undecidable. C If A≤mB and B is recursively enumerable, A is recursively enumerable. D If A≤mB and B is not recursively enumerable, A is not recursively enumerable.
Your answer
Answer & solution
Official answer: D
1. Set up the reasoning. A reduction f satisfies x∈A iff f(x)∈B and halts on every input. Compose f with a decider or recognizer for B to transfer positive algorithmic properties backward to A.
2. Derive the result. A computable mapping followed by a decider or recognizer for B supplies the corresponding algorithm for A, proving A and C; B is the contrapositive of A. D reverses this implication. For example, an empty decidable language can reduce by a constant map to a fixed nonmember of a non-r.e. language. Thus D is false.
3. Check the interpretation. Hardness transfers forward: if A is undecidable then B cannot be decidable. It does not transfer backward from a hard B to an easy A. For D, choose A empty and map every input to one fixed nonmember of a non-r.e. B.
Let ⟨M⟩ be a binary encoding of a Turing machine. Define L={⟨M⟩:M accepts at least one string of length 2014}. What is L? A decidable and recursively enumerable; B undecidable but recursively enumerable; C undecidable and not recursively enumerable; D decidable but not recursively enumerable.
Your answer
Answer & solution
Official answer: B
1. Set up the reasoning. Although there are finitely many length-2014 inputs, a simulation on one may never halt. To recognize L, interleave steps of all 22014 simulations rather than running them to completion one at a time.
2. Derive the result. Dovetail M on all finitely many binary strings of length 2014; accept its encoding when any simulation accepts, so L is r.e. It is undecidable: from machine N and input w, build M that on one fixed 2014-bit string simulates N(w), accepting iff that simulation accepts, and rejects all other inputs. A decider for L would decide acceptance. Thus B.
3. Check the interpretation. Finiteness of the input set does not decide nonacceptance. For undecidability, encode an arbitrary acceptance problem into a machine that simulates that problem on one fixed length-2014 word and rejects other words. A decision procedure for L would decide the original acceptance problem.
Which problem is undecidable for arbitrary context-free grammars? A whether a grammar is ambiguous; B whether it generates a given string; C whether its language is empty; D whether its language is finite.
Your answer
Answer & solution
Official answer: A
Step 1: Membership is decidable by a general CFG parsing algorithm, so B is not the answer. Step 2: Emptiness is decidable by marking nonterminals that can derive terminal strings and checking the start symbol. Finiteness is decidable by analyzing useful recursive growth, so C and D are also decidable. Step 3: There is no algorithm deciding ambiguity for every CFG: whether some string has multiple parse trees is an undecidable property of arbitrary grammars. Thus A. This does not say that ambiguity cannot be demonstrated for a particular grammar by an explicit witness.
Which problems are undecidable?1 CFG emptiness L(G)=∅;2 CFG universality L(G)=Σ*;3 regularity of the language of a TM;4 equality of a DFA language with an NFA language. A3 only; B3, 4; C1, 2, 3; D2, 3.
Your answer
Answer & solution
Official answer: D
Statement 1 is decidable: repeatedly mark CFG variables that can derive terminal strings; L(G) is nonempty exactly when the start variable becomes marked. Statement 2, universality of a general CFG (whether L(G)=Σ*), is undecidable. Statement 3 is undecidable by Rice’s theorem: regularity is a nontrivial property of the language recognized by a Turing machine, since some recognizable languages are regular and some are not. Statement 4 is decidable: determinize the NFA, form the product automaton for the symmetric difference with the DFA, and test whether any accepting product state is reachable. Thus only 2 and 3 are undecidable, option D.
Separate finite-state and general-machine questions. DFA/NFA equivalence remains decidable even if determinization is exponentially expensive: decidability requires termination, not efficiency. CFG emptiness is a finite fixed-point computation over its nonterminals. In contrast, general CFG universality is a standard undecidable property. TM language regularity is semantic and nontrivial, so Rice’s theorem applies; regular and nonregular recognizable languages both exist. These distinctions leave exactly 2and3.
Which problems are decidable? (1) Does a given program ever produce an output? (2) Given a context-free language L, is its complement also context-free? (3) Given a regular language L, is its complement also regular? (4) Given a recursive language L, is its complement also recursive? (A) 1,2,3,4 (B) 1,2 (C) 2,3,4 (D) 3,4. Complements, shown by overbars in the original, are essential.
Your answer
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.
Which are decidable? I: whether the intersection of two regular languages is infinite. II: whether a given context-free language is regular. III: whether two pushdown automata accept the same language. IV: whether a given grammar is context-free.
(A) I and II (B) I and IV (C) II and III (D) II and IV
Your answer
Answer & solution
Answer: B (no official key was published)
1. For I, construct a product DFA for the intersection and test whether a reachable cycle can reach an accepting state; this decides infinitude. IV is a syntactic check of the grammar’s productions: every left side must be a single nonterminal. 2. Regularity of an arbitrary CFL and equivalence of arbitrary nondeterministic PDAs are undecidable. Thus I and IV, B. 3. IV asks whether the presented grammar is context-free in form, not whether an arbitrary grammar’s language happens to be a CFL.
1. Run recognizers for L and its complement in dovetailing fashion, alternating simulation steps so neither can prevent the other from progressing. 2. Every input lies in exactly one of the two languages, so exactly one recognizer eventually accepts. Accept if it is the L recognizer and reject otherwise. 3. This constructed decider halts on every input, making L recursive, D. Nothing here guarantees regularity, context-freeness or a linear-space bound.
(A) Every NFA has an equivalent DFA (B) Every nondeterministic TM has an equivalent deterministic TM (C) Every regular language is context-free (D) Every subset of a recursively enumerable set is recursive
Your answer
Answer & solution
Answer: D (no official key was published)
1. D is false. The set Σ* is recursive and hence recursively enumerable, but it contains nonrecursive subsets, including an encoding of the halting language. 2. Even a recursively enumerable set itself need not be recursive. A holds by the subset construction for NFAs. 3. B holds because a deterministic Turing machine can dovetail the finitely branching computation tree of a nondeterministic machine, accepting exactly when an accepting branch is found. C holds because a finite automaton can be converted to a right-linear context-free grammar.
Which decision problem is undecidable? Options: (A) Membership for context-free grammars (B) Ambiguity for context-free grammars (C) Finiteness for finite-state automata (D) Equivalence for finite-state automata
Your answer
Answer & solution
Answer: B (no official key was published)
1. Approach. Distinguish a property of a particular input string from a property of all derivations of a grammar. Parsing decides membership; finite automata allow finite graph algorithms.
2. Derivation and interpretation. CFG membership is decidable by parsing. Finite-automaton finiteness is decided by useful-cycle detection, and equivalence by symmetric-difference reachability. Ambiguity of an arbitrary CFG is undecidable, so B.
P1 is decidable, P2 undecidable. Which is true? A P3 decidable if P1 reduces to P3; B P3 undecidable if P3 reduces to P2; C P3 undecidable if P2 reduces to P3; D P3 decidable if P3 reduces to its complement.
Your answer
Answer & solution
Answer: C (no official key was published)
If undecidable P2 reduces effectively to P3, a decider for P3 would decide P2 by applying the reduction first. Therefore P3 is undecidable (C). Reducing a decidable problem to P3 says nothing about P3; reducing P3 to an undecidable target also gives no such conclusion.
A reduction converts an instance of its source problem into a target instance while preserving the yes/no answer. If undecidable P2 reduces to P3 and P3 had a decider, their composition would decide P2, a contradiction. Thus C. Reduction direction matters: mapping an easy problem into a hard one does not make the easy problem hard, nor does it make the target easy.
L1 is recursively enumerable over Σ. Algorithm A enumerates its words as w1,w2,w3,… . Let #∉Σ and L2={wi#wj:wi,wj∈L1 and i<j}. Consider S1: if L1 is recursive then L2 is recursive; S2: if L2 is recursive then L1 is recursive. Which is true? The reproduction does not state whether enumeration can repeat words; keep that distinction explicit. Options: (A) Both S1 and S2 (B) S1, but S2 need not be true (C) S2, but S1 need not be true (D) Neither need be true
Your answer
Answer & solution
Answer: None (no official key was published)
1. Under repetition-free enumeration, both S1 and S2 hold (A). For S1, first decide membership of both components in recursive L1; if either is absent reject, otherwise run A until both appear and compare their unique indices.
2. For S2, if L1 is empty it is recursive. Otherwise fix its first enumerated word w1.
3. Decide whether x is in L1 by accepting x=w1 and otherwise asking the L2 decider whether w1#x belongs. Every other word appears later, so this is correct.
4. The S2 argument also survives repetitions. However, if arbitrary repetitions are permitted, S1 can fail: let recursive L1 consist of all distinct tags ae and be.
5. Enumerate each be before its ae, and repeat be after ae exactly if machine e halts, using dovetailing. Then ae#be belongs to L2 exactly for halting machines, making L2 nonrecursive despite recursive L1.
6. Thus with repetitions allowed only S2 is necessarily true (C). No unconditional option is assigned without fixing the enumeration convention.
7. Teaching check: The relation depends on enumeration positions, not a lexicographic order on words. If words repeat, one pair may have witnesses in both directions. That is why a proof using unique indices needs an explicit repetition-free convention instead of being applied automatically.
Define L={0,1}* if P=NP, and L=∅ otherwise. Which statement is true? A. L is recursive; B. L is recursively enumerable but not recursive; C. L is not recursively enumerable; D. Its recursiveness can be known only after resolving P=NP.
Your answer
Answer & solution
Answer: A (no official key was published)
1. Reason by cases without trying to resolve the open problem. If P=NP, an always-accept machine decides L. Otherwise an always-reject machine decides L. Each possible language has a halting decider, so the uncertainty about which case holds is not noncomputability of L.
2. Regardless of the truth of P=NP, L is either all binary strings or the empty language. Both are regular and recursive, so L is recursive, A. Establishing that some decider exists does not require knowing which of these two particular deciders describes L.
If a language’s strings can be effectively enumerated in lexicographic (the reproduction says “alphabetic”) order, which conclusion is intended? A. L is necessarily finite; B. L is regular but not necessarily finite; C. L is context-free but not necessarily regular; D. L is recursive but not necessarily context-free. The distinction between dictionary order and the usual effective length-first order must be addressed.
Your answer
Answer & solution
Answer: D under the standard length-lexicographic convention (no official key was published)
1. Separate two issues: whether membership is decidable, and whether the enumerator itself yields a stopping test. In effective length-first order each target has finitely many predecessors; its absence is detected once the enumeration passes it. Alphabetic dictionary order lacks that finite-predecessor property, so the conventional answer needs the stated interpretation rather than an unqualified appeal to sortedness.
2. With an effective shortlex (length-first, then alphabetic) enumeration in increasing order, membership is decided by enumerating until the target appears or an output exceeds it; if the enumerator terminates, absence is also decided. Finite languages are recursive separately. Thus the conventional result is recursive but not necessarily context-free, D; for example{0n 1n 2n} has a computable ordered enumeration. The the paper explicitly says lexicographic/alphabetic, not length-first. Ordinary dictionary order can have infinitely many predecessors, so the surpassing argument needs an additional guarantee: enumeration of 0,00,000,... never surpasses the absent string 1. The conclusion is recorded under the standard effective length-order convention, not justified by that flawed stopping argument for arbitrary dictionary order.
Decidability under a polynomial-time language isomorphism
Decidability & Computability
Tap to enlarge
L1 and L2 are languages over Σ. A bijection f:Σ*→Σ* and its inverse are polynomial-time computable, and for every x, x∈L1 iff f(x)∈L2. Which cannot hold? A. L1∈P and L2 is finite B. L1∈NP and L2∈P C. L1 is undecidable and L2 is decidable D. L1 is recursively enumerable and L2 is recursive Source caveat: GateForum drops the stars in the displayed domain/codomain; the GFG string-domain version is used here.
Your answer
Answer & solution
Answer: C (no official key was published)
1. Suppose L2 has a decider D2. An algorithm for L1 computes f(x), which always terminates, then returns D2(f(x)). The membership equivalence makes this algorithm correct and terminating. 2. Thus decidability of L2 forces decidability of L1, contradicting C. In fact the inverse supplies the converse reduction too. 3. The other combinations are not contradictions. Take f to be identity and L1=L2=∅: the language is finite, in P and NP, recursive and recursively enumerable. This single example witnesses the possibility of A, B and D.
Solution: If L₂ is decidable, compute f(x) and run its decider; the membership equivalence decides L₁. Hence an undecidable L₁ and decidable L₂ cannot coexist, option C. The other alternatives are possible by choosing finite or otherwise polynomial-time decidable languages: P is contained in NP, and recursively enumerable does not mean nonrecursive.
Define L0={⟨M,w,0⟩: M halts on w} and L1={⟨M,w,1⟩: M does not halt on w}, where M is a Turing-machine encoding, w a string and the last component a bit. Let L=L0∪L1. Which is true? A. L is recursively enumerable but its complement is not. B. Its complement is recursively enumerable but L is not. C. Both L and its complement are recursive. D. Neither L nor its complement is recursively enumerable.
Your answer
Answer & solution
Answer: D (no official key was published)
1. The halting language H is recognizable, but its complement is not recognizable: recognizers for both would yield a decider by dovetailing them. 2. Map each halting-instance pair (M,w) to ⟨M,w,1⟩. It belongs to L exactly when M does not halt. Therefore a recognizer for L would recognize the complement of H, impossible. 3. Map the same pair to ⟨M,w,0⟩. It belongs to the complement of L exactly when M does not halt. A recognizer for that complement would give the same contradiction. 4. Neither tagged language is recognizable, so D. The different tags are essential; halting and nonhalting cases are not simply being unioned without a tag.
Solution: Let H be the halting language. If L were recursively enumerable, mapping (M,w) to ⟨M,w,1⟩ would make the complement of H recursively enumerable, a contradiction. If the complement of L were recursively enumerable, mapping (M,w) to ⟨M,w,0⟩ would again recognize the complement of H. Therefore neither L nor its complement is recursively enumerable, option D. The tag prevents the union from simply being the universal set.
Prove undecidable the language of machines M that halt and output 1 on every input, by reducing the known halting problem {⟨M′,x⟩:M′ halts on x}. Construct M from M′,x. Original14(a): On input w, describe the first main step M performs.
Answer & solution
Answer: Ignore input w and simulate M′ on the hard-coded input x. (no official key was published)
Given a halting-problem instance ⟨M′,x⟩, effectively construct a machine M with M′ and x embedded in its finite description. On arbitrary input w, ignore w and simulate M′ on x. If that computation never halts, this simulation never proceeds to the next step. The construction itself does not need to decide whether M′ halts.
Reduction machine: output after the simulation halts
Decidability & Computability
Tap to enlarge
Prove undecidable the language of machines M that halt and output 1 on every input, by reducing the known halting problem {⟨M′,x⟩:M′ halts on x}. Construct M from M′,x. Original14(b): Describe its second step, depending on the first step’s outcome.
Answer & solution
Answer: If the simulation halts, output 1 and halt; otherwise continue simulating forever. (no official key was published)
After the simulation of M′ on x terminates, discard its result, output 1, and halt. The branch is triggered by any halting outcome of M′, not only acceptance or output 1. If M′ fails to halt, M never reaches this branch on any input w.
Prove undecidable the language of machines M that halt and output 1 on every input, by reducing the known halting problem {⟨M′,x⟩:M′ halts on x}. Construct M from M′,x. Original14(c): State the key equivalence relating M on arbitrary w to M′ on x.
Answer & solution
Answer: M′ halts on x iff M halts and outputs 1 on every input. (no official key was published)
If M′ halts on x, its simulation finishes regardless of the ignored input w, and M then halts with output 1 for every w. If M′ does not halt on x, M loops on every w, so its description is not in the target language. Thus ⟨M′,x⟩ belongs to HALT iff the computably constructed ⟨M⟩ belongs to {⟨N⟩: N halts and outputs 1 on every input}. A decider for the target language would decide HALT by constructing M and invoking that decider, which is impossible. Hence the target language is undecidable.
Given a Turing machine M, input w, and state q, ask whether M’s computation on w ever visits q. Is this decidable, undecidable but partially decidable, not even partially decidable, or not a decision problem?
Your answer
Answer & solution
Answer: B (no official key was published)
Step 1: Simulate M on w and accept as soon as q is visited. Every yes instance is eventually accepted; a no instance may run forever. This proves partial decidability.
Step 2: Reduce the halting problem: construct a simulator that enters a fresh designated state q exactly when the simulated machine halts. A decider for state visitation would decide halting, impossible.
Hence X is undecidable but partially decidable, B. It is a decision problem because the required answer is yes/no, regardless of whether an algorithm always produces that answer.
X asks whether a Turing machine M loops forever on input w. The halting problem H is assumed undecidable but partially decidable.
Task: Prove that X is undecidable.
Shared context
X asks whether a Turing machine M loops forever on input w. The halting problem H is assumed undecidable but partially decidable.
Answer & solution
Answer: X is undecidable. (no official key was published)
1. For a fixed valid encoding ⟨M,w⟩, exactly one possibility holds: M halts on w, or it runs forever. Thus X is the complement of H on valid encodings.
2. Assume a decider D for X exists. A decider always terminates and correctly answers both yes and no instances.
3. Construct a halting decider by running D on ⟨M,w⟩ and reversing its answer. If D says loops forever, answer does not halt; if D says does not loop forever, answer halts.
4. This new algorithm terminates on every input because D does, contradicting the assumed undecidability of H. Therefore no such D exists. Mere simulation does not refute this result: observing a halt is possible, but waiting forever is not a terminating negative test.
X asks whether a Turing machine M loops forever on input w. The halting problem H is assumed undecidable but partially decidable.
Task: Prove that X is not even partially decidable.
Shared context
X asks whether a Turing machine M loops forever on input w. The halting problem H is assumed undecidable but partially decidable.
Answer & solution
Answer: X is not partially decidable (not recursively enumerable). (no official key was published)
1. Partial decidability means a recognizer must halt and accept every yes instance, but may run forever on no instances. Let R_H be the given recognizer for halting, and suppose a recognizer R_X for nonhalting also exists.
2. On the same encoding ⟨M,w⟩, dovetail the two recognizers: execute one step of R_H, then one step of R_X, repeatedly. Do not run either one to completion before starting the other.
3. If R_H accepts, answer halts; if R_X accepts, answer does not halt. Since H and X partition valid machine-input pairs, precisely the appropriate recognizer is guaranteed eventually to accept.
4. The combined computation therefore always terminates with a correct answer, deciding H. This contradicts undecidability. Hence X is not even partially decidable, although its complement H is.
Decidability of finite-state membership and CFG infiniteness
Decidability & Computability
Tap to enlarge
Decide whether P1,finite-state-machine acceptance of a given string,and P2,infiniteness of a CFG language,are decidable. Options: both,neither,only P1,only P2.
Your answer
Answer & solution
Answer: A (no official key was published)
Step 1: For P1, simulate the finite automaton on the finite input, tracking a set of states if it is nondeterministic, then inspect acceptance. This always terminates.
Step 2: For P2, convert the productive nonempty-word portion of the grammar to Chomsky normal form with m variables. Any parse tree without a repeated variable along a root-to-leaf path has bounded height and hence bounded word length. A sufficiently long word forces a repeat and pumping to infinitely many lengths.
One can effectively test whether the CFG generates a word exceeding that finite bound by intersection with the regular language of longer words and then CFG emptiness. Hence infiniteness is decidable too, giving A.
Which constructs should be excluded to make the language’s halting function programmable: choices include arbitrary goto(v),recursive calls(vii),and repeat loops(viii), together in B? Remaining constructs are assignment,bounded for,if,forward goto,and nonrecursive calls.
Select all that apply
Answer & solution
Answer: B under the bounded-loop model (no official key was published)
Exclude arbitrary backward jumps, unrestricted recursion and unbounded repeat loops. The remaining for loops have fixed finite bounds whose control variable cannot be changed in the body; forward jumps cannot create cycles; and a finite acyclic nonrecursive call structure terminates. Structural induction on these constructs therefore proves every valid program halts. Its halting predicate is simply the constant true function, expressible in the language. This establishes the intended sufficient restriction B. The argument assumes finite evaluated bounds and ordinary bounded-for semantics, not changing loop limits or hidden nonterminating primitives.
Assume a total, correct procedure HALTS(f,x) reports whether f(x) terminates. Define FUNNY(f)=IF HALTS(f,f) THEN NOT(f(f)) ELSE TRUE. Show FUNNY terminates for every f.
Shared context
Assume a total, correct procedure HALTS(f,x) reports whether f(x) terminates. Define FUNNY(f)=IF HALTS(f,f) THEN NOT(f(f)) ELSE TRUE. Show FUNNY terminates for every f.
Answer & solution
Answer: Under the hypothetical HALTS assumption, both selected branches terminate. (no official key was published)
Interpret f as a program that can be supplied its own description as input; for the NOT expression restrict attention to programs returning Boolean values when they halt. This restricted class already suffices for the impossibility proof.
HALTS(f,f) terminates by the assumed totality of the decision procedure. If it returns FALSE, FUNNY immediately returns TRUE without running the nonterminating f(f). If it returns TRUE, its correctness guarantees that f(f) terminates. Evaluating that result and applying Boolean NOT therefore also terminates.
Thus for every such input program f, FUNNY(f) terminates and returns a Boolean. This is a conclusion conditional on the assumed existence of HALTS, not an independently implementable algorithm. Short-circuit branch selection is essential: the unselected branch must not evaluate f(f).
Assume a total, correct procedure HALTS(f,x) reports whether f(x) terminates. Define FUNNY(f)=IF HALTS(f,f) THEN NOT(f(f)) ELSE TRUE. Use termination of FUNNY to prove by contradiction that no such total correct HALTS exists.
Shared context
Assume a total, correct procedure HALTS(f,x) reports whether f(x) terminates. Define FUNNY(f)=IF HALTS(f,f) THEN NOT(f(f)) ELSE TRUE. Use termination of FUNNY to prove by contradiction that no such total correct HALTS exists.
Answer & solution
Answer: FUNNY(FUNNY) would return the negation of its own Boolean result. (no official key was published)
Assume HALTS exists as a computable, always-terminating correct decision procedure. Then the definition constructs a computable FUNNY, and part (a) shows that FUNNY terminates on every program description, including its own. Consequently HALTS(FUNNY,FUNNY) must return TRUE.
Let b be the Boolean returned by FUNNY(FUNNY). Following its definition and the TRUE answer, the same call must return NOT(FUNNY(FUNNY)), namely NOT b. This implies b=NOT b. Neither Boolean value satisfies this equation: TRUE would have to be FALSE and FALSE would have to be TRUE.
There is also an operational view: the TRUE branch invokes the identical FUNNY(FUNNY) call again before it can negate the result, producing unending recursion, contradicting the termination guaranteed by part (a). Either explanation refutes the initial assumption. Therefore no algorithm decides halting for arbitrary programs and inputs. Assuming a function can accept its own encoded description is standard for general-purpose programs; restricting output to Booleans does not avoid the contradiction.
Choose the undecidable task: bounded-step TM acceptance, TM language equivalence, DFA nonemptiness, CFG nonemptiness.
Your answer
Answer & solution
Answer: B (no official key was published)
Given a step bound k, simulate the TM for at most k steps and answer, so A is decidable. DFA nonemptiness is reachability of an accepting state. CFG nonemptiness is found by marking variables that derive terminal strings until a fixed point. TM language equivalence is undecidable: if decidable, it could compare any TM with one recognizing the empty language and thereby decide TM language emptiness, an undecidable semantic property. Thus B. Bounded simulation differs crucially from unbounded acceptance.
Select the false undecidability claim among TM halting, CFG ambiguity, CFG equivalence and regular-grammar equivalence.
Your answer
Answer & solution
Answer: D (no official key was published)
Regular grammars can be converted to finite automata. Determinize and complete the automata, form their product accepting the symmetric difference, and test whether any accepting product state is reachable. No reachable accepting state means the languages are equal. This is a terminating decision procedure, so saying regular-grammar equivalence is undecidable is false. TM halting, general CFG ambiguity and general CFG equivalence are undecidable problems. The finite-state restriction is what makes the fourth case different.
Let S be the set of positive integers x for which the decimal expansion of π contains a maximal consecutive run of exactly x digits equal to 5. Which classification is warranted: (i) regular, (ii) recursively enumerable, (iii) not recursively enumerable, (iv) recursive?
Your answer
Answer & solution
Answer: The justified choice is (ii): recursively enumerable. No claim of nonrecursiveness follows. (no official key was published)
π is a computable real, and any finite initial segment of its decimal digits can be calculated effectively. Scan these digits from left to right, keeping the length of the current run of 5s. When a non-5 follows a nonempty run, output its length and reset the counter. Because a completed run has a non-5 immediately on each side (or begins at the start of the fractional digit stream), it is maximal rather than merely a substring of a longer run. Repeated lengths may be printed repeatedly; enumeration does not require uniqueness.
Equivalently, on input x, keep scanning until a completed run of length exactly x appears, then accept. Every positive instance eventually has a finite witness and is accepted. For an absent length the scan may never halt. This establishes recursive enumerability, the warranted answer (ii).
It does not establish that S is nonrecursive. In particular, a hypothetical proof that all finite digit blocks occur in π would make S all positive integers, which is recursive (and regular under customary encodings). Normality of π is not a given and must not be assumed. Nor does failure of this particular search to halt on negative instances prove that no different decision procedure exists. Options (i) and (iv) therefore cannot be inferred merely from the stated computability facts; describing (ii) as the only possible mathematical property would overstate the argument. A regular-language claim additionally needs an encoding of integers.