Skip to main content
SingaporeComputer ScienceSyllabus dot point

How are letters, sounds and pictures all stored as binary numbers?

Explain how text (ASCII), sound (sampling) and images (pixels and colour depth) are represented as binary in a computer

A focused answer to the O-Level Computing point on representing data. How text uses character codes such as ASCII, how sound is sampled, and how images are stored as pixels with a colour depth, all as binary.

Generated by Claude Opus 4.87 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. The answer
  3. Examples in context
  4. Try this

What this dot point is asking

SEAB wants you to explain how three very different kinds of data, text, sound and images, are all stored as binary numbers. The central idea is that a computer can only hold binary, so each type of data is turned into numbers using an agreed scheme: a character code for text, sampling for sound, and a grid of coloured pixels for images.

The answer

Representing text with character codes

A computer cannot store a letter directly, so each character is given an agreed number by a character set. The most common is ASCII, which uses 77 or 88 bits per character. For example, the code for 'A' is 6565, and the codes for the other capitals follow in order ('B' is 6666, 'C' is 6767, and so on). Lower-case letters start at 'a' = 9797.

Because ASCII is a shared standard, the number 6565 always means 'A' on every computer, so text saved on one machine opens correctly on another. A newer standard, Unicode, extends this idea to cover characters from every language, including Chinese, Tamil and emoji, using more bits per character.

Representing sound by sampling

Sound is a continuous wave, but a computer needs discrete numbers. It measures (samples) the height of the wave many times per second and stores each measurement as a binary number. Two settings control the quality:

  • Sample rate: how many samples are taken per second. A higher rate captures the wave more accurately.
  • Bit depth: how many bits store each sample. More bits give finer steps in volume.

Higher sample rate and bit depth mean better quality but a larger file.

Representing images with pixels

A digital image is a grid of tiny dots called pixels. Each pixel stores a colour as a binary number. The number of bits used per pixel is the colour depth:

  • 11 bit per pixel gives 22 colours (for example black and white).
  • 88 bits per pixel give 28=2562^8 = 256 colours.
  • 2424 bits per pixel give millions of colours (true colour).

More bits per pixel allow more colours and so more detail, but make the file larger. The resolution (the number of pixels, such as width times height) also affects detail and size.

colour depth = bits per pixel
number of colours = 2 ^ (bits per pixel)

Examples in context

Example 1. A text message. When you type "Hi", the phone stores the ASCII codes 7272 and 105105 as binary. The receiving phone reads those numbers and looks them up in the same character set to display "Hi" exactly as sent.

Example 2. A photo versus a song. A high-resolution photo with 2424-bit colour and millions of pixels, and a music track with a high sample rate and bit depth, are both large files for the same reason: more bits were used to capture more detail. Reducing either setting shrinks the file but lowers quality.

Try this

Q1. State how many colours a pixel can be at a colour depth of 44 bits. [2 marks]

  • Cue. 24=162^4 = 16 colours.

Q2. Explain why ASCII is described as a standard. [2 marks]

  • Cue. Every computer agrees the same number means the same character, so text is consistent when saved, sent and opened across machines.

Q3. State two settings that affect the quality and file size of a digital sound recording. [2 marks]

  • Cue. The sample rate (samples per second) and the bit depth (bits per sample).

Exam-style practice questions

Practice questions written in the style of SEAB exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

Original5 marks(a) The ASCII code for the letter 'A' is 6565. State the ASCII code for 'C' and for 'a', explaining how you worked them out. (b) Explain why a computer needs a code such as ASCII to store text.
Show worked answer →

(a) ASCII codes for capital letters run in order from 'A' = 6565. 'C' is two letters after 'A', so its code is 65+2=6765 + 2 = 67. Lower-case letters start at 'a' = 9797, so 'a' has the code 9797 (it is 3232 more than 'A').

(b) A computer can only store binary numbers, not letters directly. ASCII gives every character an agreed number, so 'A' is stored as 65=01000001265 = 01000001_2. Because the code is a shared standard, any program or computer reading that number knows it means 'A', so text can be saved, sent and opened consistently.

Markers reward 'C' = 6767 and 'a' = 9797 with reasoning, and the idea that a code maps each character to an agreed binary number.

Original4 marksAn image is stored using a colour depth of 11 bit per pixel. (a) State how many different colours each pixel can be, and why. (b) Explain what happens to the file size and the image quality if the colour depth is increased to 88 bits per pixel.
Show worked answer →

(a) With 11 bit per pixel, each pixel can be one of 21=22^1 = 2 colours (for example black or white), because one bit has only two patterns, 00 and 11.

(b) With 88 bits per pixel, each pixel can be one of 28=2562^8 = 256 colours, so the image can show far more detail and shading, improving quality. However, each pixel now needs 88 bits instead of 11, so the file size becomes about eight times larger. More bits per pixel means more colours but a bigger file.

Markers reward 22 colours from 11 bit, 256256 colours from 88 bits, and the trade-off of higher quality against larger file size.

Related dot points