Limitations of binary representation

GCSE Computer Science (Edexcel) · Edexcel 1CP2 · 2.2.4 · Data › Data representation

75 exam-style questions on this topic, at up to four difficulty levels, with full mark schemes. Notes and past-paper booklets are open to everyone. Practice needs a free account.

Or take a quick quiz: 10 questions on this subtopic in GCSE Computer Science (Edexcel), marked as you tap.

Revision notes

Why a fixed number of bits limits what can be stored: the range of numbers, the precision of measurements, and the number of colours, amplitude values and characters. Expect 'explain why…' questions set in a context, often with a short calculation.

Key facts

  • n bits give 2n different values, no more
  • Unsigned range: 0 to 2n − 1
  • Two's complement range: −2n−1 to 2n−1 − 1
  • Overflow: a result too big for the bits available
  • Precision: a fixed number of bits gives fixed steps, so values in between are rounded
  • Colour depth limits colours; bit depth limits amplitude values; 7 bits limit ASCII to 128 characters
  • More bits = more range or precision, but bigger files

Notes

The main idea

  • Every value is stored in a fixed number of bits. n bits can only make 2n different patterns, so no more than 2n different values can ever be represented.
  • Anything that needs more values than this either cannot be stored, or has to be rounded to the nearest value that can.

Range of numbers

diagram
  • 8-bit unsigned integers store 0 to 255. 8-bit two's complement integers store −128 to +127.
  • −1280+127255unsigned: 0 to 255two's complement: −128 to +127
    Both use 256 patterns; they just cover a different range
  • A result outside the range causes an overflow: the extra bit is lost and a wrong value is stored. For example, an 8-bit counter cannot count past 255: adding 1 to 255 gives 0.
  • The fix is to use more bits. Each extra bit doubles the number of values.

Precision

diagram
  • When a measurement such as a temperature is stored in a fixed number of bits, only certain values are possible, in equal steps. A reading between two steps is rounded, so some accuracy is lost.
  • 0102030°Creading 17.3stored as 184 bits: 16 values, one every 2 °C
    Only the tick values can be stored, so a reading between two ticks is rounded. More bits give more, closer ticks
  • Shifting bits off the right-hand end loses precision in the same way: the fraction is thrown away.
  • More bits give smaller steps, so values are stored more precisely.

Images, sound and text

  • Colour depth: 1 bit gives only 2 colours and 8 bits only 256. A photo stored with too few bits loses shades and may show bands of colour.
  • Bit depth: each sound sample must be rounded to one of 2n amplitude values, so the stored wave is only an approximation.
  • Characters: 7-bit ASCII has only 128 codes, so it cannot store accented letters, other alphabets or emoji.
  • The trade-off: more bits improve range, precision or quality, but increase file size, the storage needed and the time taken to transmit the data. Grade 9+ only

How to answer each type of question

Explain why a value cannot be stored

2 marksGrade 5
  1. State the largest (or smallest) value the number of bits allows.
  2. Compare it with the value in the question.
  3. Say what happens (an overflow, a wrong value) or what is needed (more bits).

Example. A school stores the number of students in each year group as a 7-bit unsigned binary integer. A new year group has 150 students.
Explain why this number cannot be stored.

Show the model answerHide the model answer
The largest value 7 bits can store is 127 (27 − 1) (1). 150 is greater than 127, so it would cause an overflow / at least 8 bits are needed (1).

Explain how the number of bits limits accuracy

2 marksGrade 7
  1. Say how many different values the bits allow.
  2. Say that the values come in fixed steps, so readings between steps must be rounded.
  3. Link to the context: what detail is lost.

Example. A light sensor measures from 0 to 1000 lux. Each reading is stored as a 4-bit unsigned integer: 0 means 0 lux, 15 means 1000 lux, and the values in between are evenly spaced.
Explain why the stored readings are not very accurate.

Show the model answerHide the model answer
4 bits give only 16 different values to cover the whole range, so each step is about 67 lux (1000 ÷ 15) (1). Any reading between two steps has to be rounded to the nearest stored value, so small changes in the light level cannot be recorded (1).

Calculate the minimum number of bits needed

2 marksGrade 8
  1. Find the largest value (or the number of different values) that must be stored.
  2. Find the power of 2 that is just too small, and the next one, which is big enough.
  3. State the number of bits.

Example. A machine counts the products made during a shift. Up to 5000 products are made in one shift.
Calculate the minimum number of bits needed to store the count. Show your working.

Show the model answerHide the model answer
12 bits can store up to 212 − 1 = 4095, which is not enough
(1)
13 bits can store up to 213 − 1 = 8191, so 13 bits
(1)

Discuss a trade-off

3 to 4 marksGrade 9
  1. Say what the extra bits improve (range, precision, number of colours or amplitude values).
  2. Explain the benefit in the context.
  3. Give the cost: bigger files, more storage, longer to transmit.
  4. Explain the effect of that cost in the context.

Example. A smart doorbell stores 10-second audio clips. The designers are deciding whether to store each sample using 8 bits or 16 bits.
Discuss the advantages and disadvantages of using 16 bits.

Show the model answerHide the model answer
16 bits give 65,536 amplitude values instead of 256 (1), so each sample is rounded less and voices are recorded more accurately (1). However, each clip needs twice as much storage (1), so fewer clips can be kept and each one takes longer to send to the owner's phone (1).

Don’t lose marks

  • Writing 'the number is too big' without giving the limit for that number of bits (e.g. 127 for 7 bits).
  • Saying an extra bit adds one value. It doubles the number of values.
  • Forgetting that 0 uses up a pattern: 8 bits store 0 to 255, not 0 to 256.
  • Saying more bits are 'better' without mentioning the cost: bigger files and more storage.
  • Not linking the answer to the context in the question (the sensor, the counter, the image).

More tips

Memory tricks

  • Ask 'how many patterns?' first: 2n. Every limitation comes back to that number.
  • Out of range: overflow. Between steps: rounding. Not in the set: cannot be represented.
  • One more bit doubles the number of values; it does not just add one.
  • Useful limits: 4 bits 15, 7 bits 127, 8 bits 255, 16 bits 65,535 (unsigned).

Exam technique

  • Use numbers in your explanation: the limit (e.g. 255), the value that does not fit, and how many bits would be needed.
  • In 'discuss' or 'evaluate' questions, give both sides: what extra bits improve and what they cost.
  • Spot this topic in disguise: questions on overflow, colour depth, bit depth or ASCII can all be testing limitations.

What each grade needs

What you need to be able to do, from the first marks up to the top grade.

  1. Grade 4
    State the range of values for n bitsUnsigned: 0 to 2n − 1; two's complement: −2n−1 to 2n−1 − 1.
  2. Grade 5
    Explain why a value cannot be storedA value outside the range needs more bits than are available, so it causes an overflow.
  3. Grade 6
    Explain the limits of colour and bit depthFew bits give few colours or amplitude values, so detail is lost or values are rounded.
  4. Grade 6
    Explain the limits of a character set7-bit ASCII has only 128 codes, so it cannot represent every character in every language.
  5. Grade 7
    Explain precision limits when storing measurementsA fixed number of bits gives fixed steps, so values between the steps have to be rounded.
  6. Grade 8
    Calculate the minimum bits for a requirementFind the smallest power of 2 that covers every value needed.
  7. Grade 9
    Evaluate trade-offs between bits, quality and sizeMore bits give more range or precision but need more storage and take longer to transmit.

Quick recall

Cover the answers and test yourself. The app has these as flashcards that come back just before you'd forget them.

State the number of different colours that each pixel can have.
2
The lift is moved to a new building that has floors numbered from 0 to 20.
Explain why the floor number can no longer be stored in 4 bits.
4 bits can only store 0 to 15, so floors 16 to 20 cannot be represented.
State the number of different characters that can be represented using 7-bit ASCII.
128
An 8-bit unsigned binary counter holds 11111111. A program adds 1 to the counter. The answer needs 9 bits but the counter only has 8 bits. Name the type of error that happens.
Overflow
A character set can represent characters from most of the world’s writing systems. It uses more bits for each character than ASCII. Name the character set.
Unicode
Give the term for the number of bits used to store the colour of each pixel in an image.
Colour depth

Sample questions

Written for this site in the style of Edexcel exam questions. They are not taken from real past papers.

Question 1Easy4 marks
A school prints its newsletter on a printer that can only print black dots on white paper. Every image in the newsletter is stored as a bitmap with a colour depth of 1 bit.
(a) State the number of different colours that each pixel can have.
[1]
(b) A colour photograph of the school’s sports day is converted to this format.
Explain why the converted image is not an accurate copy of the photograph.
[2]
(c) The school changes the colour depth of its images to 8 bits. The resolution stays the same.
State the effect of this change on the file size of each image.
[1]
Show the answer and mark scheme
(a) Answer: 2
  • 2 (21)
(b) Answer: 1 bit gives only two values, so each pixel must be black or white; every other colour and shade has to be changed to one of these, so detail is lost.
  • with 1 bit per pixel, each pixel can only be one of two colours (black or white)
  • so every other colour and shade in the photograph has to be changed to black or white, and colour / shading / detail is lost
(c) Answer: It is 8 times larger.
  • the file size is 8 times larger
Question 2Medium5 marks
A greenhouse sensor measures temperatures from 0 °C to 51 °C. Each reading is stored as an 8-bit unsigned binary integer. The stored value 0 represents 0 °C, the stored value 255 represents 51 °C, and the values in between are evenly spaced.
(a) Calculate the change in temperature represented by an increase of 1 in the stored value.
[2]
(b) The actual temperature is 20.1 °C. Explain why the sensor cannot store this temperature exactly.
[2]
(c) Give one change that would allow the temperature to be stored more precisely.
[1]
Show the answer and mark scheme
(a) Answer: 0.2 °C
  • 51 ÷ 255
  • 0.2 (°C)
(b) Answer: Temperatures can only be stored in steps of 0.2 °C (100 = 20.0 °C, 101 = 20.2 °C), so 20.1 °C has to be rounded.
  • the stored values can only represent temperatures in steps of 0.2 °C, e.g. 100 represents 20.0 °C and 101 represents 20.2 °C
  • 20.1 °C is between two values that can be stored, so it has to be rounded (to 20.0 °C or 20.2 °C)
(c) Answer: Store each reading using more bits, e.g. 16 bits, so the steps are much smaller.
  • use more bits for each reading, e.g. 16 bits, so that the steps between stored values are smaller / use the same 8 bits for a smaller range of temperatures
Question 3Hard6 marks
A traffic counter records the number of vehicles that pass it each day. The count is stored as a 16-bit unsigned binary integer and is reset to 0 at midnight.
(a) State the largest count that can be stored.
[1]
(b) On a busy motorway, an average of 4 vehicles pass the counter every second, all day.
Explain whether the counter can store the total for a whole day. You must include a calculation in your answer.
[3]
(c) Calculate the minimum number of bits needed to store the daily total for this motorway.
[2]
Show the answer and mark scheme
(a) Answer: 65,535
  • 65,535 (216 − 1)
(b) Answer: 4 × 86,400 = 345,600 vehicles a day, which is more than 65,535, so the counter would overflow.
  • vehicles in a day: 4 × 60 × 60 × 24 / 4 × 86,400
  • = 345,600
  • 345,600 is greater than 65,535, so the total cannot be stored: the count overflows and the stored total would be wrong
(c) Answer: 19 bits
  • 218 = 262,144, which is less than 345,600
  • 219 = 524,288 is enough, so 19 (bits)

More in Data representation

Stuck? Get 1-to-1 help.

Chhetri Academy tutors GCSE and A level Maths and Science online, with a free 30-minute trial lesson.