Difficulty: Easy
Correct Answer: 14
Explanation:
Introduction / Context:
This checks understanding of Java's bitwise AND (&), XOR (^), and OR (|) using small integers, and requires converting between decimal and binary mentally.
Given Data / Assumptions:
Concept / Approach:
Use binary forms: AND keeps bits set in both, XOR keeps bits set in exactly one, OR keeps bits set in either.
Step-by-Step Solution:
Verification / Alternative check:
Cross-check by quick calculator or mental recomputation of each bit position.
Why Other Options Are Wrong:
They correspond to misapplying XOR or OR, or mixing decimal and binary values incorrectly.
Common Pitfalls:
Confusing XOR with OR, or forgetting leading zeros in alignment when writing binary.
Final Answer:
14
Discussion & Comments