# C Programming - Bitwise Operators - Discussion

Discussion Forum : Bitwise Operators - General Questions (Q.No. 4)

4.

Which bitwise operator is suitable for checking whether a particular bit is on or off?

Discussion:

29 comments Page 1 of 3.
Harsha said:
3 years ago

I am not thinking that it is a true answer.

There is no logic and bitwise & binary operator it takes min 2 operands, so how it check that whether a particular bit is on or off.

There is no logic and bitwise & binary operator it takes min 2 operands, so how it check that whether a particular bit is on or off.

ANAND said:
8 years ago

What is the use of || operator? Please explain me friends.

Vykuntapu gopi said:
8 years ago

The output of logical operators gives 0/1.

The output of bitwise operators gives decimal of given numbers.

Example:

(a=5)&&(b=2)

the a&b are both are non-zero numbers it gives result as 1

if

(a=5)&&(b=0)

So result is 0.

Because one of operands b is zero.

But in bitwise operators, the operation goes on the binary number of given operands.

if

(a=2)&(b=1)

convert the 2,1 binary numbers in 4 bits that 8421;

2's binary number 0010

1's binary number is 0001

0&0=0

0&0=0

1&0=0

0&1=0

Output is 0

The output of bitwise operators gives decimal of given numbers.

Example:

(a=5)&&(b=2)

the a&b are both are non-zero numbers it gives result as 1

if

(a=5)&&(b=0)

So result is 0.

Because one of operands b is zero.

But in bitwise operators, the operation goes on the binary number of given operands.

if

(a=2)&(b=1)

convert the 2,1 binary numbers in 4 bits that 8421;

2's binary number 0010

1's binary number is 0001

0&0=0

0&0=0

1&0=0

0&1=0

Output is 0

Rahul_B said:
8 years ago

@Pritam & @Guru Sai.

There is no option of OR(|) in the given question.

How it be? Explain.

There is no option of OR(|) in the given question.

How it be? Explain.

Guru sai Jaya prakash said:
8 years ago

0 | 0 = 0.

1 | 0 = 1.

So, why can't we use like this?

1 | 0 = 1.

So, why can't we use like this?

Pritam said:
8 years ago

I don't understand, why always & operator use. Truth table of | or operator also provides logical relation then why always &?

Ramya said:
9 years ago

Can anyone explain bitwise operators by writing a program?

Navya.ch said:
9 years ago

Then why can't we use?

Gajanan said:
9 years ago

@Dimple,

You are correct. Why we can used (|) instead of (&)?

You are correct. Why we can used (|) instead of (&)?

Ghanshyam Sharma said:
9 years ago

I think that the right answer is D.

For eg:

If I write if(a) then it is 1.

If I write if(!a) then it is 0.

For eg:

If I write if(a) then it is 1.

If I write if(!a) then it is 0.

Post your comments here:

Your comments will be displayed after verification.

Quick links

Quantitative Aptitude

Verbal (English)

Reasoning

Programming

Interview

Placement Papers

© IndiaBIX™ Technologies