Difficulty: Easy
Correct Answer: 3 and 4
Explanation:
Introduction / Context:
This question compares basic arithmetic with shift operations to see which yield the same result for constant integers, reinforcing that left shift by n multiplies by 2^n for non-overflowing operands.
Given Data / Assumptions:
Concept / Approach:
Evaluate each expression: integer division truncates, comparison yields boolean, multiplication is straightforward, and left shift scales by a power of two. Compare the numeric outcomes for equality.
Step-by-Step Solution:
Verification / Alternative check:
Binary form: 3 is 0b0011; shifting left by 2 → 0b1100 = 12, matching 3*4.
Why Other Options Are Wrong:
Common Pitfalls:
Forgetting that <<
is arithmetic scaling for non-overflowing positive ints; also mixing boolean and numeric expressions.
Final Answer:
3 and 4
Discussion & Comments