GATE / CS ARCHIVE

GATE CSE 1999 / QUESTION 2.5

Restricting a language to terminating programs

Theory of Computation · Decidability & Computability · Full GATE CSE 1999 paper

GATE 1999, Q2.5 2 marks · MSQ
Report issue

Decidability & Computability

Question 2.5, GATE 1999: 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.
Question 2.5, GATE 1999: 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.
Tap to enlarge
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.

Original paper, page 3