ProgrammingModerateGATE CS · Campus placements
How many trailing zero bits does 96 have? (96 is 1100000 in binary.)
- A. 5
- B. 4
- C. 6
- D. 3
Correct answer: A. 5
96 = 2^5 * 3, so five low bits are zero. Lowest set bit tricks such as x & -x find the same position.
More C Programming questions
- What is the index of the highest set bit of 1000 (so 2^index is the largest power of two that is at most 1000)?
- uint16t x = 0x0F00; uint16t y = x & (uint16t)(0u - x); What is y?
- int a[] = {2, 4, 6, 8}; int p = a + 3, q = a; What does printf("%td", p - q) print?
- char names[3][5] = {"ab", "cde", "f"}; What is strlen(names[1]) + sizeof names[2]?
- A recursive function sums decimal digits: int ds(int n) { return n < 10 ? n : n % 10 + ds(n / 10); }. What is ds(98765)?
- How many 1 bits does 0xDEADBEEF have in binary?