a) (v | (v + 1)) == 0;

b) (~v & (v – 1)) == 0;

c) (v | (v – 1)) == 0;

d) (v & (v – 1)) == 0;

### 1 thought on “Which of these expressions will return true if the input integer v is a power of two?”

### Leave a Comment

You must be logged in to post a comment.

d

Explanation: Power of two integers have a single set bit followed by unset bits.