ITPEC FE Morning October 2023 Question 2

Source exam: ITPEC FE Morning October 2023Topic: Basic Theory & Math

ITPEC FE Morning October 2023 — Question 2 of 80

Bit Shifting for Multiplication — compute 7 × n using shift and add/subtract.

Key idea: decompose the multiplier into powers of 2, then use shifts.

7 = 8 - 1 = 2³ - 1, so:
7n = (n << 3) - n

  • (a) (n << 2) + n = 4n + n = 5n
  • (b) (n << 2) - n = 4n - n = 3n
  • (c) (n << 3) + n = 8n + n = 9n
  • (d) (n << 3) - n = 8n - n = 7n

Key rule: Left shift by k bits = multiply by 2^k. Decompose any multiplier into sums/differences of powers of 2.

Common patterns:
- 3n = (n << 1) + n

- 5n = (n << 2) + n

- 7n = (n << 3) - n

- 9n = (n << 3) + n

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.