☑Kizspy.me
(Choose 1 answer)
☐ A
☐ E
Which of the following procedures are recursive algorithms?
(i) procedure tt1(x: int, n: positive int)
d:=0
for i=1 to n do
d:=d+x
print(d)
(ii) procedure tt2(x: int, n: positive int)
If n=1 then tt2(x,n):=x
else tt2(x,n): tt2(x,n-1)+x
(iii) procedure tt3(n: positive int)
S:=0
For i=1 to n do
s:=s+n
Print(s)
(iv) procedure tt4(n: positive int)
If n=1 then tt4(n):=1
else tt4(n): tt4(n-1)+n;
A. (iii), (iv)
B. (i), (ii)
C. (ii), (iv)
D. (i), (iii)
E. None of the other choices is correct
FUQ.sh
sh the exam.