GIAC Python Coder (GPYC) — Question 30

What is the output of the following line of code typed into a Python interactive session?
>>> print(bin(0b101010 ^0b111000))

Answer options

Correct answer: C

Explanation

The code performs a bitwise XOR operation between the binary numbers 0b101010 and 0b111000, resulting in 0b10010. This is the correct output, which is why option C is right. Options A, B, and D do not reflect the result of the XOR operation performed in the code.