Job Interview Questions on Bit Fiddling


  1. Write a C program to count bits set in an integer?

  2. What purpose do the bitwise and, or, xor and the shift operators serve?

  3. How to reverse the bits in an integer?

  4. Check if the 20th bit of a 32 bit integer is on or off?

  5. How to reverse the odd bits of an integer?

  6. How would you count the number of bits set in a floating point number?



These questions are taken from Cracktheinterview Team.

2 comments: