Question: (1 point) Check ALL correct statments about the following algorithms. procedure double(n: positive integer) while n > 0 begin n: 2n end output(n) A. This


(1 point) Check ALL correct statments about the following algorithms. procedure double(n: positive integer) while n > 0 begin n: 2n end output(n) A. This algorithm lacks finiteness B. When n-5 is the input, the while loop is infinite. C. When n 5 is the input, n-10 is the final output of the algorithm { procedure divide(n: positive integer) while n > 0 begin m:- 1 n:= n-1 end output(m) y A. This algorithm lacks definateness since division by zero occurs. B. When n=1 is the input, the algorithm exits the while loop after the first iteration and outputs m=1. C. This algorithm works and always outputs1 D. This algorithm works and outputs 1. E. When n=1 is the input, after the first iteration of the while loop we have m=1 and n=0 F. When n-1 is the input, on the second iteration of the while loop a division by zero occurs
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
