edited by
7,986 views

5 Answers

7 7 votes
$\underline{\textbf{Answer:}\Rightarrow}\mathbf{B)\;5}$

$\underline{\textbf{Explanation:}\Rightarrow}$

$\underline{\text{Step:1}}$

$\mathrm{x = 1,\;i = 1}$

$\underline{\text{Step:2}}$

$\mathrm{x = 2,\;i = 2}$

$\underline{\text{Step:3}}$

$\mathrm{x = 4,\;i = 3}$

$\underline{\text{Step:4}}$

$\mathrm{x = 16,\;i = 4}$

Now, $\mathrm{x = 16}\le500$

$\underline{\text{Step:5}}$

$\mathrm{x = 2^{16},\;i = 5}$

$\therefore \;\mathbf 5$ is the right answer.
6 6 votes

ans is B  value of i=5  initially x=1<1000 so i becomes 2 then x=2 , i =3 ,then x=4 , i=4 then x=16, i=5 now x=2^16>1000 so exit finally i=5

0 0 votes
B

because when x =16, the while loop was (16<=500)executed then i= 5 and x=2^16, next  in whlie(2^16<=500) it is false . so ans is 5
0 0 votes
before while loop

                x=1           i=1

in while loop

               x=2            i=2

               x=4            i=3

               x=16           i=4

               x= 65536       i=5

now,while condition fails and terminates.hence,i=5
Answer:
Position:
Show:

Related questions

7 7 votes
2 answers 2 answers
8.9k
8.9k views
go_editor asked Jun 23, 2016
8,934 views
Which of the following algorithm design technique is used in merge sort?Greedy methodBacktrackingDynamic programmingDivide and Conquer
8 8 votes
2 answers 2 answers
15.3k
15.3k views
shivanisrivarshini asked May 31, 2016
15,326 views
Let $T(n)$ be defined by $T(1) =10$ and $T(n+1)=2n+T(n)$ for all integers $n \geq 1$. Which of the following represents the order of growth of $T(n)$ as a function of $n...
4 4 votes
3 answers 3 answers
9.4k
9.4k views
ajit asked Oct 1, 2015
9,379 views
Number of comparisons required for an unsuccessful search of an element in a sequential search organized, fixed length, symbol table of length L isLL/2(L+1)/22L