ProgrammingHardGATE CS · Campus placements
How many leading zero bits does the 16-bit unsigned value 0x0100 have?
- A. 7
- B. 8
- C. 23
- D. 4
Correct answer: A. 7
0x0100 = 0000 0001 0000 0000 has its top set bit at index 8, so 15 - 8 = 7 zeros precede it. 8 confuses the bit index with the count, 23 counts in a 32-bit width, and 4 counts only the leading zero hex digit.
More C Programming questions
- What is the popcount of (1ULL << 40) | (1ULL << 3)?
- c is a char holding '5'. What is printf("%d", (c - '0') 2)?
- How many 1 bits does 0b10101 have?
- A table of size 7 uses h(k) = k % 7 with linear probing. Keys 14, 21, 7 and 0 are inserted in that order. In which slot does key 0 land?
- Linear probing with a tombstone-free delete: keys 0 and 7 both hash to slot 0 in a table of size 7. 0 is stored at slot 0 and 7 at slot 1…
- Chaining with head insertion: keys 10, 3 and 17 all hash to bucket 3 in a table of size 7. Which key is first in the chain after the three…