The | bitwise operator is suitable for turning on the bit in a number.
OR (|) bitwise operator is suitable for turning on a particular bit in a number. To arrive at the solution, we can clearly eliminate options A and C as they represent logical AND and logical OR operations, respectively. Now option B is bitwise AND (&), it cannot be used to turn on a particular bit in a number because if the input bit is 0, the bitwise AND will return 0 as the output. On the other hand, if bitwise OR is used, even if the input bit is set to 0, it will activate the output.
☛ Related Questions:
Commentswrite a comment