Which of the following is/are bit manipulation operators ?
- 1. ||
- 2. ^
- 3. >>
- 4. <<
Select the correct answer using the code given below :
1 only
1, 2 and 3
2 and 4 only
1, 2 and 4
Answer is Wrong!
Answer is Right!
This question was previously asked in
UPSC CISF-AC-EXE – 2020
1. `||` is the logical OR operator, which operates on boolean values (or treats non-zero as true). It is not a bit manipulation operator.
2. `^` is the bitwise XOR operator, which compares corresponding bits and returns 1 if they are different, and 0 if they are the same. This is a bit manipulation operator.
3. `>>` is the bitwise right shift operator, which shifts all bits in an operand to the right by a specified number of positions. This is a bit manipulation operator.
4. `<>`), and 4 (`<
– Common bitwise operators include AND (`&`), OR (`|`), XOR (`^`), NOT (`~`), left shift (`<>`).
– Logical operators (`&&`, `||`, `!`) work on boolean values.