Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

ISRO | ISRO CS 2016 | Question 23

  • Last Updated : 23 Mar, 2018

Consider the following segment of C-code:

int j, n;
j = 1;
while (j <= n)
       j = j * 2;

The number of comparisons made in the execution of the loop for any n > 0 is:
(A) |_ log 2n _| * n
(B) n
(C) |_ log2n _|
(D) |_ log2n _| + 1


Answer: (D)

Explanation:

Quiz of this Question
Please comment below if you find anything wrong in the above post

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!