edited by
5,003 views

5 Answers

6 votes
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

4 votes
4 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.
0 votes
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
Answer:

Related questions

7 votes
7 votes
2 answers
1
go_editor asked Jun 23, 2016
7,828 views
Which of the following algorithm design technique is used in merge sort?Greedy methodBacktrackingDynamic programmingDivide and Conquer
8 votes
8 votes
1 answer
2
shivanisrivarshini asked May 31, 2016
11,390 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...
3 votes
3 votes
2 answers
3
ajit asked Oct 1, 2015
6,877 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
39 votes
39 votes
4 answers
4
Rucha Shelke asked Sep 17, 2014
25,191 views
Which one of the following in place sorting algorithms needs the minimum number of swaps?Quick sortInsertion sortSelection sortHeap sort