ITPEC FE Morning October 2022 Question 1
ITPEC FE Morning October 2022 — Question 1 of 80
Setting the Least Significant Bit — use OR with a bitmask to force a specific bit to 1.
To set the LSB of an 8-bit integer to 1 without changing other bits, perform bitwise OR with 00000001.
- •
x OR 0 = x— unchanged bits - •
x OR 1 = 1— forced to 1
Why not others:
- (a) AND 00000001 — clears all bits except LSB (x AND 0 = 0)
- (b) NAND 11111110 — NAND = NOT(AND), inverts the result, corrupts other bits
- (d) XOR 00000001 — toggles LSB instead of setting it (flips 1 → 0)
Key rule: OR sets bits, AND clears bits, XOR toggles bits.
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.