Skip to main content

O Level ยท Computer Science

Data Representation: O Level Computer Science

How a computer stores everything as binary: denary, binary and hexadecimal, binary addition and shifts, twoโ€™s complement, text, sound and images, units of storage, file sizes and compression.

  • Lesson
  • 7 quizzes
  • Worksheet PDF

A step-by-step lesson, 7 self-marking quizzes and a printable worksheet, all on Data Representation for O Level.

Data Representation: the short answer

Inside every computer are billions of transistors: tiny electronic switches. A switch has only two states, on or off. We write on as 1 and off as 0, and a number system that uses only those two digits is called binary.

Learn it: the lesson

Data Representation: Binary and Hex, Sound, Images and Compression8 steps ยท one idea at a time ยท quick check at the endStart the lesson โ†’
What the lesson covers8 steps ยท tap to see
  1. 1Why computers work in binary

    Inside every computer are billions of transistors: tiny electronic switches.

    Learn this in the lesson โ†’
  2. 2Denary, binary and hexadecimal

    A number system is described by its base: how many different digits it uses.

    Learn this in the lesson โ†’
  3. 3Converting between binary and denary

    Binary to denary. Write the place values above the bits, then add up the place values that have a 1 under them.

    Learn this in the lesson โ†’
  4. 4Converting with hexadecimal

    Binary to hex. Split the binary into groups of four bits from the right; a group of four bits is a nibble.

    Learn this in the lesson โ†’
  5. 5Why hexadecimal is so useful

    The computer itself never uses hexadecimal.

    Learn this in the lesson โ†’
  6. 6Adding binary numbers, and overflow

    Binary addition works like denary column addition, from right to left, carrying into the next column.

    Learn this in the lesson โ†’
  7. 7Logical shifts: multiplying and dividing by 2

    A logical shift moves every bit in a register a number of places to the left or right.

    Learn this in the lesson โ†’
  8. 8Twoโ€™s complement: storing negative numbers

    An ordinary byte only holds 0 to 255.

    Learn this in the lesson โ†’
  9. Quick check: see what you remember

Data Representation: O Level Computer Science notes

Why computers work in binary

Inside every computer are billions of transistors: tiny electronic switches. A switch has only two states, on or off. We write on as 1 and off as 0, and a number system that uses only those two digits is called binary. One binary digit is a bit.

Two states are easy to build, easy to store and very hard to confuse, even when the signal is weak or noisy. That makes a two-state system far more reliable than one with ten levels for the ten denary digits.

Because the hardware only understands 1s and 0s, every form of data must be converted to binary before a computer can process it:

  • numbers are stored using binary place values;
  • text is stored as a binary code for each character;
  • sound is stored as binary measurements of the sound wave;
  • images are stored as binary values for the colour of each pixel;
  • program instructions are stored as binary too.

The processor works on this data using logic gates, circuits that take 1s and 0s in and give a 1 or 0 out, and it holds the values it is working on in registers, small stores with a fixed number of bits.

Key facts

  • We write on as 1 and off as 0, and a number system that uses only those two digits is called binary.
  • The processor works on this data using logic gates, circuits that take 1s and 0s in and give a 1 or 0 out, and it holds the values it is working on in registers, small stores with a fixed number of bits.
  • Split the binary into groups of four bits from the right; a group of four bits is a nibble.
  • A logical shift moves every bit in a register a number of places to the left or right.
  • To store negative numbers as well, we use twoโ€™s complement.
  • It looks the character up in a character set: a list of every character the computer can show, each with its own unique binary code.

Data Representation MCQs with answers

Tap an answer to check it.

  1. Computers use the binary system because:

    Answer: B. Circuits have two states, on and off Computer circuits have two states, on and off, which map directly to the binary digits 1 and 0.

  2. Binary 11111111 in denary is:

    Answer: C. 255 All eight bits set gives 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255.

  3. Add binary 00101101 + 00010011:

    Answer: C. 01000000 45 + 19 = 64; in binary, 00101101 + 00010011 = 01000000 after carrying through the lower bits.

  4. What is denary โˆ’1 in 8-bit twoโ€™s complement?

    Answer: B. 11111111 Write 1 in binary, flip every bit, then add 1.

More questions in the 7 quizzes below โ†“ ยท All O Level Computer Science MCQs with answers โ†’

Data Representation: common questions

What is meant by binary?

We write on as 1 and off as 0, and a number system that uses only those two digits is called binary. One binary digit is a bit.

What is meant by sample rate?

The sample rate is the number of samples taken in one second, in hertz (Hz). Music is often sampled 44 100 times a second.

What is meant by sample resolution?

The sample resolution is the number of bits used for each sample. With 3 bits there are only 8 levels to choose from (as in the diagram); with 16 bits there are 65 536, so each sample is far closer to the true amplitude.

What is meant by pixels?

A bitmap image is a grid of tiny squares called pixels. The colour of each pixel is stored as a binary number, and the image is stored as all those numbers, row by row.

What is meant by resolution?

The resolution is the number of pixels in the image, usually given as width ร— height, for example 1920 ร— 1080. More pixels show finer detail.

How can I practise Data Representation?

Try the questions on this page, then the 7 self-marking quizzes below, which explain every answer. The worksheet gives the same practice on paper, with an answer sheet.

Practise real quizzes on this topic: 7 quizzes

Each quiz marks itself the moment it is finished and explains every answer. Start easy and work up.

๐Ÿ–จ๏ธData RepresentationComputers store everything in binary, and hexadecimal is a shorter way to write the same bit patterns, with each hex digit standing for four bits.See the worksheet โ†’

โฌ‡ Download free PDFFree sample copy with a light QuizByt mark. A free account gives you more.