Difficulty: Easy
Correct Answer: 32, 32, 32, 32, 0
Explanation:
Introduction / Context:
This problem reinforces equivalence between decimal and hexadecimal literals and the behavior of bitwise OR, AND, and XOR when both operands have exactly the same bit set. Here, 32 and 0x20 are the same value.
Given Data / Assumptions:
Concept / Approach:
When the operands are identical, OR and AND both equal the same value, while XOR becomes zero because there are no differing bits. Printing the five integers demonstrates this symmetry clearly.
Step-by-Step Solution:
Recognize i == j == 32.k = i | j = 32 | 32 = 32.l = i & j = 32 & 32 = 32.m = k ^ l = 32 ^ 32 = 0.printf prints: 32, 32, 32, 32, 0.
Verification / Alternative check:
Change j to 0x10 (16) and re-run to see different outcomes, emphasizing how XOR becomes nonzero when bits differ.
Why Other Options Are Wrong:
They imply mismatched values between decimal and hex, or misapply bitwise logic (e.g., XOR of equal values cannot be nonzero).
Common Pitfalls:
Assuming hex implies a different numeric value; forgetting binary representations; mixing up meanings of OR vs XOR.
Final Answer:
32, 32, 32, 32, 0
Discussion & Comments