Page 166 - ComputerScience_Class_11
P. 166
b. Bitwise OR (|): When both the results are false, this operator returns false else it returns true.
nd
st
st
nd
1 Bit 2 Bit 1 Bit | 2 Bit
0 0 0
0 1 1
1 0 1
1 1 1
c. Bitwise Not(~): Bitwise Not or Bitwise Complement operator, works on one operand only and it returns the reverse
of the output. That is, it negates the result.
st
st
1 Bit ~(1 Bit)
0 1
1 0
d. Bitwise XOR(^) : This operator results in false if the operands are of the same value.
st
nd
st
nd
1 Bit 2 Bit 1 Bit ^ 2 Bit
0 0 0
0 1 1
1 0 1
1 1 0
Some Solved Examples:
1. 6 & 3
First, we have to convert the given digits into their equivalent binary values.
6 = 0110 (In Binary)
3 = 0011 (In Binary)
Bit Operation of 6 & 3
0110
& 0011
0010 which is 2 in decimal
Ans. 2
2. 10 | 7
10 = 1010 (In Binary)
7 = 0111 (In Binary)
Bit Operation of 10 | 7
1010
| 0111
00001111 which is 15 in decimal
Ans. 15
3. ~5
5 = 0101 (In Binary)
~(5) = 1010 which is -5 in decimal
Ans. -5
164 Touchpad Computer Science (Ver. 3.0)-XI

