RRB JE CBT2 : EXPERT
27 Jun

Bitwise Operators and Their Meaning

OperatorNameMeaningExample
&Bitwise ANDResult bit is 1 only if both bits are 15 & 3 = 1
|Bitwise ORResult bit is 1 if at least one bit is 15 | 3 = 7
^Bitwise XORResult bit is 1 if bits are different5 ^ 3 = 6
~Bitwise NOT (Complement)Inverts all bits (0→1, 1→0)~5 = -6 (in two's complement)
<<Left ShiftShifts bits to the left by specified positions (×2 for each shift)5 << 1 = 10
>>Right ShiftShifts bits to the right by specified positions (÷2 for each shift, for positive numbers)8 >> 1 = 4
Comments
* The email will not be published on the website.