ITPEC FE Morning April 2022 Question 2

Source exam: ITPEC FE Morning April 2022Topic: Basic Theory & Math

ITPEC FE Morning April 2022 — Question 2 of 80

Bitwise equivalence of modulo and addition — convert (A mod 32) + 64 to bitwise form.

Key rules:
- A mod 2^n = A AND (2^n − 1) — extracts the lowest n bits

- + 2^k = OR 2^k — when the bit being set doesn't overlap with existing bits

Step-by-step:
- A mod 32 → 32 = 2⁵ → A AND 31 (31 = 0b11111, extracts bits 0–4)

- + 64 → 64 = 2⁶ = 0b1000000 → bit 6 doesn't overlap with bits 0–4 → OR 64

- Result: (A AND 31) OR 64(a)

Why not others:
- (b) A AND 32 extracts only bit 5, not lower 5 bits; OR 32 sets bit 5, not bit 6

- (c) A OR 31 sets lower bits to 1 instead of extracting; AND 64 zeroes everything except bit 6

- (d) A OR 64 sets bit 6 but AND 32 keeps only bit 5, losing all other information

Key rule: mod 2^nAND (2^n − 1); non-overlapping + 2^kOR 2^k.

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.