Ad Banner Placeholder
Cambridge IGCSE Computer Science — 0478
Topic 1: Data Representation — Part 1
Number Systems
Understanding number bases
- Binary (Base 2)
- Computers use binary because they are made of electronic components (like transistors) that have only two states: on (1) or off (0).
- Denary (Base 10)
- The standard system used by humans for counting.
- Hexadecimal (Base 16)
- Used by programmers as a shorthand representation of binary. It is more compact and easier for humans to read and type.
- Common uses: MAC addresses, RGB colour codes, and identifying errors in assembly code.
Conversions
| Conversion Type | Method | Worked Example |
|---|---|---|
| Binary to Denary | Add place values (128, 64, 32—) where the bit is 1. | 1011 = 8 + 2 + 1 = 11 |
| Denary to Binary | Repeatedly divide by 2 and record remainders; read remainders from bottom to top. | 13 ? 1101 = 1101 |
| Hex to Binary | Convert each hex digit to a 4-bit nibble and combine. | B2 ? B(11) = 1011, 2 = 0010 ? 10110010 |
| Denary to Hex | Convert denary to binary first, then split into nibbles. | 47 ? 0010 1111 ? 2F |
Binary addition
Addition rules: 0 + 0 = 0; 1 + 0 = 1; 1 + 1 = 0 (carry 1); 1 + 1 + 1 = 1 (carry 1).
Worked example: 0110 + 0011 = 1001 (denary 6 + 3 = 9).
- Overflow error
- Occurs when the result of an addition is too large to be represented by the available bits (e.g., a result greater than 255 in an 8-bit register).
Logical binary shifts
- Left shift
- Moves all bits to the left, adding 0s on the right. This multiplies the positive integer by 2 for every place shifted.
- Right shift
- Moves all bits to the right, adding 0s on the left. This divides the positive integer by 2 for every place shifted.
Note: Bits shifted off the end of the register are lost.
Exam Traps
- Logical shifts in these notes apply to positive integers — do not assume the same left/right rules work for negative two's complement values without a separate method.
Two's complement
Used to represent negative binary integers. The Most Significant Bit (MSB) has a negative value (e.g., -128 for 8-bit).
To convert negative denary to 8-bit binary:
- Write the positive version in binary.
- Pad to 8 bits with leading 0s.
- Invert all bits (0 to 1, 1 to 0).
- Add 1 to the result.
0/15
Ad Banner Placeholder