Skip to content
Related Articles

Related Articles

ISRO | ISRO CS 2007 | Question 15

Improve Article
Save Article
Like Article
  • Last Updated : 21 Jun, 2018

Consider the following pseudo-code

x:=1;
i:=1;
while (x <= 1000)
begin
  x:=2^x;
  i:=i+1;
end;

What 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      5

After this condition becomes false.

So, i = 5, Option (B) is correct.

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!