ISRO | ISRO CS 2017 | Question 74

Consider the function

int func(int num) {
int count = 0;
while(num) {
count++;
num >>= 1;
}
return(count) ;
}

For func(435) the value returned is
(A) 9
(B) 8
(C) 0
(D) 10


Answer: (A)

Explanation: For detailed solution refer GATE-CS-2014-(Set-2)
So option (A) is correct.

Quiz of this Question



My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.