Computer Sciences > Gate 2018 > Loops
Consider the following C code. Assume that unsigned long int type length is 64 bits.

unsigned long int fun(unsigned long int n) {
    unsigned long int i, j = 0, sum = 0;
    for( i = n; i > 1; i = i/2) j++;
        for( ; j > 1; j = j/2) sum++;
            return sum;
}


The value returned when we call fun with the input 240 is
A
4
B
5
C
6
D
40

Correct : Loops

Similar Questions

A palindrome is a word that reads the same forwards and backwards. In a game of words, a player has the following two plates painted with letters. From...
#1 MCQ
Which number does not belong in the series below? 2, 5, 10, 17, 26, 37, 50, 64
#4 MCQ
Choose the word that is opposite in meaning to the word “coherent”.
#5 MCQ

Related Topics

No tags found

Unique Visitor Count

Total Unique Visitors

Loading......