Vidyalelo
C Programming · Q28

Operators and Expressions

Programming · C Programming · question 28

Q28

Which operator is used to perform a bitwise XOR operation in C?

A.
&&
B.
||
C.
&
D.
^
Answer

Answer: Option D

Solution

Answer: Option D
Solution:
In C, the ^ operator is used to perform a bitwise XOR (exclusive OR) operation. It performs a bitwise XOR between corresponding bits of two integers. It returns a new integer where each bit is the result of XORing the corresponding bits of the operands.

Option A (&&) represents the logical AND operator, used for logical comparisons, not bitwise operations.
Option B (||) represents the logical OR operator, used for logical comparisons, not bitwise operations.
Option C (&) represents the bitwise AND operator, used for bitwise AND operations, not bitwise XOR.