If X is a binary number which is power of 2, then the value of X & (X – 1) is :
Show answerHide answer
Correct answer: (B) 00.......00
Explanation
Let x = 2³ = 8 = 1000; then x – 1 = 7 = 0111. Now x & (x – 1) = 0000 (& is bitwise AND: a result bit is 1 only if both compared bits are 1, otherwise 0). So for any power of 2 the result is all zeros.