1.

Which of the following statements are correct about the program? #include int main() { unsigned int num; int c=0; scanf("%u", &num); for(;num;num>>=1) { if(num & 1) c++; } printf("%d", c); return 0; }

A. It counts the number of bits that are ON (1) in the number num.
B. It counts the number of bits that are OFF (0) in the number num.
C. It sets all bits in the number num to 1
D. Error
Answer» B. It counts the number of bits that are OFF (0) in the number num.


Discussion

No Comment Found

Related MCQs