C Programming - Bitwise Operators - Discussion

Discussion Forum : Bitwise Operators - True / False Questions (Q.No. 4)
4.
Bitwise & can be used to check if more than one bit in a number is on.
True
False
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
7 comments Page 1 of 1.

Shreedevi said:   4 years ago
1 & 1 = 1.

Pavan said:   4 years ago
Thanks for explaining @Divya.

Satya said:   9 years ago
We have to follow & truth table: 1 & 11111111 then we get 1.

Asif ali said:   1 decade ago
Bitwise operator is used for check one bit in a number is on or off both.

Divya said:   1 decade ago
Checking if more than one bit in a number is on, is nothing but counting no:of 1s in a number..

int c=0;
for(;num;num>>=1)
{ if (num & 1)
c++;
}
printf(" no:of bits on=%d",c);

Datta said:   1 decade ago
1+1=1

Sreejith said:   1 decade ago
Could anyone please explain me the answer?

Post your comments here:

Your comments will be displayed after verification.