C Programming - Bitwise Operators - Discussion

4. 

Bitwise | can be used to multiply a number by powers of 2.

[A]. Yes
[B]. No

Answer: Option B

Explanation:

No answer description available for this question.

Raushan said: (Aug 3, 2011)  
For power operation, multiplication is done repeatedly the same number of time as is the number. Direct bitwise operation for power is not available.

Ranjit said: (Aug 23, 2011)  
Multiplying by a power of 2 is the same as shifting to the left. If you shift it left by 3 places you multiply it by 2^3=8. Similarly shifting to the right is division by powers of 2.

Abhayraj Sn said: (Sep 1, 2016)  
<< (LEFT SHIFT) multiplies by 2.
>> (RIGHT SHIFT) divides by 2.

Correct me if it's wrong!

Ionut said: (Nov 19, 2016)  
<< (LEFT SHIFT n positions) multiplies by 2^n.

>> (RIGHT SHIFT n positions) divides by 2^n.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.