Practice question · Sort into groups
Four bits can hold the values 0 to 15. Sort each number by whether four bits are enough to store it.
Groups: Fits in 4 bits · Needs more than 4 bits
- 15
- 31
- 16
- 20
- 0
- 9
Hints
- Four bits give 16 different patterns, and the counting starts at 0.
- Work out the largest value four bits can reach, then compare each number with it.
Show the answer
Fits in 4 bits: 15, 9, 0
Needs more than 4 bits: 16, 31, 20
Why
Four bits give patterns, numbered 0 to 15, so 15 fits exactly and 16 does not. Confusing the number of patterns (16) with the largest storable value (15) is the standard off-by-one of binary sizing, and it is the same mistake as expecting a byte to reach 256.
Practise Information Encoding and Binary Representation
The app has 8 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.