Which of the following is/are bit manipulation operators ? 1. || 2.

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
This question was previously asked in
UPSC CISF-AC-EXE – 2020
Bit manipulation operators (or bitwise operators) perform operations on individual bits of integers. From the given list:
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 (`<
– Bitwise operators work on the binary representation of numbers.
– Common bitwise operators include AND (`&`), OR (`|`), XOR (`^`), NOT (`~`), left shift (`<>`).
– Logical operators (`&&`, `||`, `!`) work on boolean values.
The options provided seem incomplete as `>>` (3) is also a bit manipulation operator. However, option C correctly identifies two bit manipulation operators from the list without including any incorrect ones.
Exit mobile version