ITPEC FE Morning October 2020 Question 4
ITPEC FE Morning October 2020 — Question 4 of 80
Bitwise AND Masking — extract specific bits from a byte using a bitmask.
To extract the lower 7 bits from an 8-bit code (ignoring the MSB parity bit), perform AND with 7F:
- •
7F=0111 1111in binary - •
ANDwith1preserves the bit;ANDwith0clears it - •Result: bit 7 (parity) is cleared, bits 0–6 remain unchanged
Example: 1010 0110 AND 0111 1111 = 0010 0110
Why not others:
- (a) AND with 0F — 0000 1111 clears bits 4–6 too, losing data
- (c) OR with 0F — OR sets bits to 1, doesn't extract; corrupts lower nibble
- (d) XOR with FF — inverts all 8 bits (bitwise NOT), doesn't extract
Key rule: To isolate specific bits, use AND with a mask where target bits = 1 and unwanted bits = 0.
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.