Skip to content
Related Articles

Related Articles

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

Attention reader! Don't stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :