What does the following function f() in 'C' return?

int f(unsigned int N) {unsigned int counter = 0; while (N > 0) {counter += N & 1;

N = N >> 1;} return counter == 1;}

1
1 if N is odd, otherwise 0
2
1 if N is a power of 2, otherwise 0
3
1 if the binary representation of N is all 1's, otherwise 0
4
1 if the binary representation of N has any 1's, otherwise 0

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation