ITPEC FE Morning April 2019 Question 1
ITPEC FE Morning April 2019 — Question 1 of 80
Bit Shift Multiplication — using left/right bit shifts to perform multiplication by decomposing the multiplier.
Left shift by n bits = multiply by 2ⁿ. Right shift by n bits = divide by 2ⁿ.
To multiply x by 5, decompose: 5 = 4 + 1 = 2² + 1.
So: (x << 2) + x = 4x + x = 5x.
Evaluate each option:
- (a) (x << 1) + x = 2x + x = 3x
- (b) (x << 2) + x = 4x + x = 5x ✓
- (c) (x >> 1) − x = x/2 − x = −x/2
- (d) (x >> 2) − x = x/4 − x = −3x/4
Why not others:
- (a) Left shift by 1 gives ×2, so 2x + x = 3x, not 5x
- (c) Right shift divides; subtracting x gives a negative fraction
- (d) Same issue as (c) — divides then subtracts, yielding a negative result
Key rule: To multiply by a constant using shifts, decompose the constant into powers of 2 and combine with add/subtract.
AI-generated — may contain errors
The original exam layout is preserved in the image so diagrams, formulas, tables, and code remain accurate.
This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.