Consider the following C code. Assume that unsigned long int type length is 64 bits.
The value returned when we call
c
fun with the input is- A4
- B5
- C6
- D40
AlgorithmsAsymptotic Analysis (O, Omega, Theta Complexities)MCQ2 marks · −2/3 if wrongMedium
1unsigned long int fun(unsigned long int n){
2 unsigned long int i, j = 0, sum = 0;
3 for (i = n; i > 1; i = i/2) j++;
4 for ( ; j > 1; j = j/2) sum++;
5 return(sum);
6}
7fun with the input \(2^{40}\) isA GATE question every morning
One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.