Gate CS-2007 Question Paper With Solutions

75 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

Base of Log is 2 in all options.

Gate CS-2007 Question Paper With Solutions

Answer: (D)

Explanation:

Gate CS-2007 Question Paper With Solutions

Learn More:   Gate CS-2014-3 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here