ProgrammingModerateTCS NQT · Infosys
How many 1 bits are set in 2^20 - 1 (a 32-bit unsigned value)?
- A. 19
- B. 20
- C. 21
- D. 10
Correct answer: B. 20
2^20 - 1 has its low 20 bits set and nothing else, so the popcount is 20.
More C Programming questions
- uint8t a = 16; a = a a; What is a?
- uint32t t = 2000000000u + 2000000000u; What is t?
- char buf[10]; char a = buf + 2, b = buf + 9; What does printf("%td", b - a) print?
- struct P { int x, y; } arr[4]; struct P p = arr; p += 2; What is p - arr?
- #define MIN(a,b) ((a)<(b)?(a):(b)). What does printf("%d", MIN(MIN(3,1),2)) print?
- int x = 5; printf("%d", x > 3 ? x - 3 : x + 3); What is printed?