A brief note on Number Systems . Read it before a test. Try each question at the end before you open its answer.
The three bases Denary is base 10, with the digits 0 to 9. Binary is base 2, with the digits 0 and 1. A computer stores all data in binary because its switches have two states. Hexadecimal is base 16, with 0 to 9 and A to F (A is 10, F is 15). One hex digit is one nibble of four bits. Place values 8-bit binary: 128, 64, 32, 16, 8, 4, 2, 1. 16-bit binary: the next places are 256, 512, 1024 and so on, up to 32768. Hexadecimal: 4096, 256, 16, 1. 8-bit two's complement: − 128 -128 − 128 , 64, 32, 16, 8, 4, 2, 1. The conversions Binary to denary. Add the place values under the 1s. Denary to binary. Take away the largest place values that fit, or divide by 2 again and again and read the remainders upwards. Binary to hex. Split into nibbles from the right. Each nibble is one digit. Hex to binary. Write each digit as four bits. Denary to hex. Divide by 16: the whole part is the first digit and the remainder is the second. Arithmetic on a register Addition. 1 + 1 = 10 1 + 1 = 10 1 + 1 = 10 and 1 + 1 + 1 = 11 1 + 1 + 1 = 11 1 + 1 + 1 = 11 . Carry from right to left. Overflow. An 8-bit register holds 0 to 255. A larger total loses its ninth bit. Logical left shift of k k k places multiplies by 2 k 2^k 2 k . Logical right shift divides by 2 k 2^k 2 k . Bits that fall off are lost and 0s come in. Two's complement. To store a negative number, write the positive one, flip every bit and add 1. The range is − 128 -128 − 128 to + 127 +127 + 127 . A worked example Store − 58 -58 − 58 in 8-bit two's complement.
The positive number. 58 = 32 + 16 + 8 + 2 58 = 32 + 16 + 8 + 2 58 = 32 + 16 + 8 + 2 , which is 00111010. Flip every bit. 11000101. Add 1. 11000110. Check. − 128 + 64 + 4 + 2 = − 58 -128 + 64 + 4 + 2 = -58 − 128 + 64 + 4 + 2 = − 58 . Practice with new numbers
A program to try The program prints one number in all three bases, using Python's format. It then reads each form back to show they are the same number.
Read it first. Then run it. Which of the three forms is the shortest?
1. Change the number to 250. Predict the binary and the hex before you run it.
Mistakes to avoid Reading the remainders downwards. The first remainder is the last bit. Grouping nibbles from the left. Always group from the right. Forgetting the lost bit. An overflow or a shift can push a 1 out of the register. Flipping without adding 1 in two's complement. Check yourself Convert the binary number 01111001 to denary. Stuck? Show a hint Show the answerConvert the hexadecimal number 2F to binary. Stuck? Show a hint Show the answerAdd 01000001 and 00111111 in an 8-bit register. Is there an overflow? Stuck? Show a hint Show the answerWhat does the register 00000111 hold after a logical left shift of 4 places? Stuck? Show a hint Show the answerWrite − 1 -1 − 1 as an 8-bit two's complement number. Stuck? Show a hint Show the answerSources Cambridge International, IGCSE Computer Science 0478 syllabus for 2026 to 2028, section 1.1 (number systems).