📚 Question Bank Q87 — Programming and Data Structure
Tags
Programming and Data Structure
Q87. Marks: +2.0 UGC NET Paper 2: Computer Science 26th Nov 2021

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 ✓ Correct
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
📄 All “Programming and Data Structure” questions across papers
🏷 Change Tag for this Question