Data Representation and Number Systems
Computers store everything as binary digits, and the exam tests conversion between binary, denary, octal and hexadecimal, signed number representation, character coding, and the calculation of file sizes for images and sound.
Bases and conversion
Binary is base 2, octal base 8, denary base 10, hexadecimal base 16 (0–9 then A–F). To convert binary to hex, group the bits in fours from the right; for octal, group in threes. Hex is used because it is compact and maps exactly onto four bits.
Representing signed integers
Two's complement: invert every bit and add 1. The most significant bit carries a negative weight, −2^(n−1). For n bits the range is −2^(n−1) to 2^(n−1) − 1, so 8 bits give −128 to +127.
Characters and media
ASCII uses 7 bits (128 characters); extended ASCII uses 8. Unicode covers the world's writing systems. Image size in bytes = width × height × colour depth ÷ 8. Sound size in bytes = sample rate × bit depth × channels × seconds ÷ 8.
Worked example
Interpret 1101 1011. Hex: split as 1101 = D and 1011 = B, so the value is DB. Unsigned denary: 128 + 64 + 16 + 8 + 2 + 1 = 219. As an 8-bit two's complement number, the leading bit is worth −128: −128 + 64 + 16 + 8 + 2 + 1 = −37. Check: +37 is 0010 0101; invert → 1101 1010; add 1 → 1101 1011 ✓.
Traps that cost marks
- Dropping leading zeros - 5 in 8 bits is 0000 0101, not 101.
- Giving the unsigned answer when the question says "signed" or "two's complement".
- Forgetting to divide by 8, so the file size is quoted in bits instead of bytes.
- Mixing Kb (kilobit) with KB (kilobyte): 1 KB = 8 Kb.