Do you want to attend FREE Bootcamp of IT courses?
On taking one’s complement of a number, all 1’s present in the number are changed to 0’s and all 0’s are changed to 1’s.
One’s complement operator is represented by the symbol ~.
Right Shift Operator:
The right shift operator is represented by >>. It needs two operands. It shifts each bit in its left operand to the right. The number of places the bits are shifted depends on the number following the operator.
Thus, ch >> 4 would shift all bits in ch four places to the right. Similarly, ch >> 3 would shift all bits three places to the right.
Note that as the bits are shifted to the right, blanks are created on the left. These blanks are always filled with zeros.
Left Shift Operator:
This is similar to the right shift operator, the only difference being that the bits are shifted to the left, and for each bit shifted, a 0 is added to the right of the number.
Thus, ch << 4 would shift all bits in ch four places to the left. Similarly, ch << 3 would shift all bits three places to the left.
Bitwise AND Operator:
Bitwise OR Operator:
Your test is submitted successfully. Our team will verify you test and update in email for result.