ITPEC FE Subject A October 2025 Question 2

Let n be a binary integer represented in two’s complement. Which of the following is the operation that results in the value 9 × n using only bit shifting and an addition or subtraction?

Explanation

Shift 3 bits to the left, then add the original value — 9n = 8n + n, and a 3-bit left shift multiplies by 8.

A left shift by k bits multiplies a two's complement integer by 2k, as long as the result does not overflow.

  • •Write 9 as a power of two plus a small term: 9 = 8 + 1 = 23 + 1
  • •Shift n 3 bits to the left: 8n
  • •Add n: 8n + n = 9n

Answer (c)

Why not others:

  • •(a) — a 2-bit shift is only ×4, so the result is 4n + n = 5n
  • •(b) — 4n − n = 3n
  • •(d) — subtracts instead of adding: 8n − n = 7n

Key rule: To multiply by a constant with shifts, write it as a sum or difference of powers of two, such as 9 = 23 + 1 or 7 = 23 − 1, and shift once for each power.

Basic Theory · AI-written, may contain errors

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.