Computer Science I / Information Encoding and Binary Representation
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

Hints
  1. Four bits give 16 different patterns, and the counting starts at 0.
  2. 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 24=162^{4} = 16 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.

Read the lesson: Information Encoding and Binary Representation →

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.

More questions on Information Encoding and Binary Representation