Skip to main content
SingaporeComputer ScienceSyllabus dot point

How do we measure amounts of data, and how does compression make files smaller?

Use units of storage from bit to terabyte, and explain lossless and lossy compression and why files are compressed

A focused answer to the O-Level Computing point on data measurement. Units from bit and byte up to terabyte, calculating file sizes, and the difference between lossless and lossy compression and why files are compressed.

Generated by Claude Opus 4.86 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 use the units that measure amounts of data, from the bit up to the terabyte, to work out simple file sizes, and to explain compression: what lossless and lossy compression are, how they differ, and why files are compressed at all. The central idea is that all storage is measured in multiples of the byte, and compression trades some combination of detail or processing for a smaller file.

The answer

Units of storage

The smallest unit is the bit (one binary digit). Eight bits make a byte. Above the byte, each unit is about 10001000 times the one below it (using the common decimal convention):

Unit Symbol Approximate size
bit b a single 00 or 11
byte B 88 bits
kilobyte KB about 10001000 bytes
megabyte MB about 10001000 KB
gigabyte GB about 10001000 MB
terabyte TB about 10001000 GB

Strictly, computers count in powers of two, so 1 KB=10241\ \text{KB} = 1024 bytes, but at O-Level the round figure of 10001000 is accepted unless a question says otherwise.

Calculating a simple file size

To estimate a file size, work out the total bits and convert to bytes. For an image, multiply the number of pixels by the colour depth:

total bits = number of items x bits per item
total bytes = total bits / 8

Why we compress files

Compression makes a file smaller. This saves storage space, speeds up transfer over a network (less data to send), and uses less bandwidth, which matters for streaming, email attachments and web pages.

Lossless compression

Lossless compression reduces the size without losing any data, so the original file can be restored exactly. It works by storing information more efficiently, for example recording a repeated pattern once with a count. It is used where every bit matters: text documents, spreadsheets, program code and some image formats.

Lossy compression

Lossy compression achieves much smaller files by permanently removing detail that a person is unlikely to notice, such as subtle colours in a photo or sounds the ear cannot easily hear. The original cannot be fully restored. It is used for photos, music and video, where a small loss of quality is an acceptable price for a much smaller file.

Examples in context

Example 1. Streaming a video. A streaming service uses lossy compression so a film fits the viewer's internet speed. The picture loses a little fine detail, but it can be sent smoothly in real time, which would be impossible with the full uncompressed data.

Example 2. Zipping a folder of documents. A student zips a folder of reports and code before emailing it. The zip uses lossless compression, so when the recipient unzips it, every document and line of code is restored exactly, with nothing lost.

Try this

Q1. State how many bytes are in one megabyte, using the decimal convention. [2 marks]

  • Cue. About 10001000 kilobytes, so about 10000001\,000\,000 bytes.

Q2. Give two reasons a website might compress its images. [2 marks]

  • Cue. Smaller files load faster for users and use less bandwidth and storage.

Q3. A file must be restored to its exact original after transfer. State which type of compression must be used and why. [2 marks]

  • Cue. Lossless, because it loses no data and so the original can be rebuilt exactly.

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.

Original4 marks(a) Place these units of storage in order from smallest to largest: megabyte, bit, gigabyte, byte, kilobyte. (b) State how many bits are in one byte, and roughly how many bytes are in one kilobyte.
Show worked answer →

(a) From smallest to largest: bit, byte, kilobyte, megabyte, gigabyte. Each step up is about 10001000 times larger than the one before (using the common decimal convention).

(b) One byte is 88 bits. One kilobyte is about 10001000 bytes (more precisely 10241024 bytes when measured in powers of two, but 10001000 is accepted at this level).

Markers reward the correct order, 88 bits per byte, and roughly 10001000 bytes per kilobyte.

Original5 marksA photographer must email a 12 MB12\ \text{MB} photo but the limit is 5 MB5\ \text{MB}. (a) Explain the difference between lossless and lossy compression. (b) Recommend which type suits this situation and give one reason. (c) State one situation where lossless compression should be used instead.
Show worked answer →

(a) Lossless compression makes a file smaller without losing any data, so the original can be restored exactly (for example by storing repeated patterns once). Lossy compression makes a file much smaller by permanently removing some detail the eye or ear is unlikely to notice; the original cannot be fully restored.

(b) Lossy compression suits the photo. It can shrink a 12 MB12\ \text{MB} image well below 5 MB5\ \text{MB}, and a small loss of fine detail is acceptable for an emailed photo.

(c) Lossless should be used where every bit matters, such as a text document, a spreadsheet, program code, or a medical or legal image, where losing any data would be unacceptable.

Markers reward the lossless-versus-lossy distinction, lossy for the photo with a reason, and a valid lossless case such as text or program files.

Related dot points