Consider the following pseudo-code
x:=1; i:=1; while (xWhat is the value of i at the end of the pseudo-code?
(A) 4
(B) 5
(C) 6
(D) 7
Answer: (B)
Explanation: Initialisation: x = 1, i = 1;Loop: x i 21 2 22 3 24 4 216 5After this condition becomes false.
So, i = 5, Option (B) is correct.
Quiz of this Question
Article Tags :
Recommended Articles