Data Representation
Binary, denary, hexadecimal, two's complement, ASCII, Unicode, sound, images and compression.
1 Number Systems
Computers use binary because their transistors can only be in two states โ ON (1) or OFF (0). Every form of data โ text, images, sound โ must be converted to binary to be processed.
| Number System | Base | Digits Used | Primary Use |
|---|---|---|---|
| Binary | 2 | 0, 1 | Inside computers (hardware level) |
| Denary (Decimal) | 10 | 0โ9 | Everyday human use |
| Hexadecimal | 16 | 0โ9, AโF | Programmers โ compact binary representation |
Bit = single binary digit (0 or 1). Nibble = 4 bits. Byte = 8 bits. Data is processed using logic gates and stored in registers.
2 Conversions
Binary โ Denary: Multiply each binary digit by its place value (powers of 2), then add the results.
Example: 11010110 = 128+64+16+4+2 = 214 Denary โ Binary (repeated division by 2): 45 รท 2 = 22 remainder 1 22 รท 2 = 11 remainder 0 11 รท 2 = 5 remainder 1 5 รท 2 = 2 remainder 1 2 รท 2 = 1 remainder 0 1 รท 2 = 0 remainder 1 Read bottom to top: 00101101 (8-bit)
3 Hexadecimal
1 hex digit = exactly 4 binary bits (1 nibble). Binary becomes much shorter: 1101 0011 1010 1101 โ D3AD
In the exam, always split binary into nibbles from the RIGHT when converting to hex. For 10111 โ split as 0001 0111 โ 17
4 Binary Arithmetic & Overflow
An overflow error occurs when a calculation result is too large for the available bits. In 8-bit, max is 255. Results >255 cause overflow โ leading bits are lost.
An overflow does NOT always mean a wrong answer was entered โ it means the correct answer cannot be represented in the given number of bits.
5 Logical Shifts
- Bits move left by n places
- Zeros fill from the right
- Effect: multiplies by 2โฟ
- Bits move right by n places
- Zeros fill from the left
- Effect: divides by 2โฟ
When bits fall off the end of the register they are permanently lost. If significant bits are lost, the result will be incorrect.
6 Two's Complement
Two's complement represents negative integers. The MSB has negative place value (โ128 for 8-bit).
- Write positive number in 8-bit binary
- Flip all bits (0โ1, 1โ0) โ one's complement
- Add 1 to the result
Convert โ45: +45 = 00101101 Flip = 11010010 Add 1 = 11010011 โ Answer: โ45
To read negative: add place values with โ128 for MSB. 11010011 = โ128+64+16+2+1 = โ45
7 Text โ ASCII & Unicode
- 7 bits per character (128 chars)
- Extended ASCII uses 8 bits (256 chars)
- Covers English alphabet, digits, symbols
- 'A' = 65, 'a' = 97, '0' = 48
- Uses more bits per character
- Covers 100,000+ characters
- Supports all world languages and emojis
- Backward compatible with ASCII
Unicode requires more storage per character than ASCII because it needs more bits for a larger character set.
8 Sound Representation
Sound is an analogue wave. To store digitally, the wave is sampled at regular intervals. Each sample is stored as a binary number.
| Term | Definition | Effect of Increasing |
|---|---|---|
| Sample rate | Samples per second (Hz) | More accurate, larger file |
| Sample resolution | Bits per sample | More precise, larger file |
Always use 1024 for unit conversions: 1 KiB = 1024 bytes, 1 MiB = 1024 KiB, 1 GiB = 1024 MiB.
9 Image Representation
A digital image is made of pixels โ tiny squares of colour. Each pixel's colour is stored as binary.
| Term | Definition | Effect of Increasing |
|---|---|---|
| Resolution | Total pixels (width ร height) | Higher quality, larger file |
| Colour depth | Bits per pixel | More colours, larger file |
10 Data Storage Units
1 Bit = binary digit | 1 Byte = 8 bits | 1 KiB = 1024 bytes | 1 MiB = 1024 KiB | 1 GiB = 1024 MiB
11 Compression
Compression reduces file size. Benefits: less storage, less bandwidth, faster transfers.
- No data lost
- Original can be reconstructed
- Used for: text, PNG images
- Permanently removes data
- Original cannot be reconstructed
- Used for: MP3, JPEG
Once lossy compression is applied, lost data is gone permanently. You cannot "undo" lossy compression.
