Q2
What is the result of `6 | 3` ?
A.
9
B.
6
C.
3
D.
7
AnswerAnswer: Option D
Solution
Answer: Option D
Solution:
The bitwise OR operator (|) performs a bitwise OR operation on each corresponding bit of the two numbers. In this case, the binary representation of 6 is 110, and the binary representation of 3 is 011. When performing a bitwise OR, if any of the corresponding bits is 1, the result bit will be 1; otherwise, it will be 0. So, performing 6 | 3 results in 111, which is 7 in decimal notation. Therefore, the correct answer is Option D.