Computer Science

Common mistakes in data representation

6 mistakes learners make with data representation, each one named and explained.

All common mistakes

Everything is stored as binary, and the units and place values have fixed sizes.

Binary added as if it were denary

What it looks like

1 + 1 in binary is written as 2.

Why it happens

Adding in denary is automatic, and nothing about binary stops a 2 being written.

A worked example

Question. Add 1 + 1 in binary.

A common answer. 2

The answer. 10

Why. Binary only has 0 and 1, so 1 + 1 is 0 carry 1, written 10.

Put the two side by side

Denary: 1 + 1 = 2.
Binary: 1 + 1 = 10, which is two.

In binary, any 2 becomes 0 with a 1 carried.

Binary place values miscounted

What it looks like

A binary number is converted with the columns shifted, giving a power of two out.

Why it happens

The columns double rather than going up in tens, so a slip of one column changes the answer by a factor of two.

A worked example

Question. What is 1010 in denary?

A common answer. 12

The answer. 10

Why. The columns are 8, 4, 2, 1. Ones sit in the 8 and the 2 columns, giving 8 + 2 = 10.

Put the two side by side

Getting a column wrong doubles or halves the answer.
Write the column headings first, then read off.

Always write 8 4 2 1 above the digits before converting.

Bits and bytes swapped

What it looks like

A byte is said to be one bit, or a bit to be 8 bytes.

Why it happens

The two words sound alike and both are units of data.

A worked example

Question. How many bits are in a byte?

A common answer. 1

The answer. 8

Why. A bit is a single 0 or 1; a byte is 8 of them.

Put the two side by side

Bit: one binary digit.
Byte: 8 bits.

Bit is the shorter word and the smaller unit.

Bits and bytes, or the size factor, confused

What it looks like

A file size is out by a factor of eight, or kilo is treated as exactly a thousand where the question wants 1024.

Why it happens

The words sound alike and the factors are close enough that a wrong one still looks plausible.

A worked example

Question. How many bits are in 2 bytes?

A common answer. 2

The answer. 16

Why. A byte is 8 bits, so 2 bytes is 16 bits. Bit and byte differ by a factor of eight throughout.

Put the two side by side

Bits are the single ones and zeros.
Bytes are groups of eight of them.

Write the factor of 8 down before calculating.

One more bit expected to add one more value

What it looks like

Increasing the colour depth from 2 to 3 bits is said to give one more colour.

Why it happens

One more bit sounds like one more of anything.

A worked example

Question. How many colours can 3 bits represent?

A common answer. 3

The answer. 8

Why. Each extra bit doubles the number of patterns: 2^3 = 8.

Put the two side by side

2 bits: 4 colours.
3 bits: 8 colours, double.

Each bit doubles the number of values: 2 to the power of the number of bits.

The wrong data type chosen for the value

What it looks like

A price is stored as an integer, or an identifier that is never calculated with is stored as a number.

Why it happens

Types are chosen by what the value looks like rather than by what will be done with it.

A worked example

Question. Which type suits a price like 4.99?

A common answer. Integer

The answer. Real or float

Why. Integers hold whole numbers only, so 4.99 would lose its pence. A value with a fractional part needs a real type.

Put the two side by side

Integers are for whole counts.
Reals are for values with a fractional part.

Choose the type from what the value must be able to hold and do.

WAJD spots these patterns in your child's answers and names the one behind their wrong answers, instead of just marking them wrong.

More computer science topics