HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Notes
  2. /Storage Units and Compression: Quick Revision
Computer Science

Storage Units and Compression: Quick Revision

A brief note on storage units from the bit to the exbibyte, file sizes, lossy and lossless compression and run-length encoding. With the usual slips, practice, a program and questions to check yourself.

StemPy LabWritten by StemPy Lab
Log in to save

A brief note on Storage Units and Compression. Read it before a test. Try each question at the end before you open its answer.

The units

  • Bit: a single 0 or 1. Nibble: 4 bits. Byte: 8 bits.
  • KiB, MiB, GiB, TiB, PiB, EiB: each is 1024 of the one before.
  • Down the ladder, multiply by 1024. Up the ladder, divide.
  • Always use 1024, never 1000.

File sizes

  • Image bits === width ×\times× height ×\times× colour depth.
  • Sound bits === sample rate ×\times× resolution ×\times× seconds.
  • Divide by 8 for bytes, then by 1024 for each step up. Answer in the unit asked for.
  • To count files that fit, use one unit for both and round down.

Compression

  • Why: less storage space, less bandwidth, shorter transmission time.
  • Lossy: removes data for good. Lower the resolution or colour depth of an image, or the sample rate or resolution of a sound.
  • Lossless: no data is lost. Example: run-length encoding.
  • Run-length encoding stores each run as a count and a value. It helps when there are long runs, and makes data with no runs bigger.

A worked example

An image is 128 by 96 pixels with a colour depth of 16 bits. Find its size in KiB.

  1. Bits. 128×96×16=196608128 \times 96 \times 16 = 196608128×96×16=196608 bits.
  2. Bytes. 196608÷8=24576196608 \div 8 = 24576196608÷8=24576 bytes.
  3. KiB. 24576÷1024=2424576 \div 1024 = 2424576÷1024=24 KiB.

Practice with new numbers

A program to try

The program gives a size in every unit from bytes up to GiB, and run-length encodes a short row of pixels.

Read it first. Then run it. In which unit is the number closest to 1?

1. Change the row so that every pixel is W. How many pairs are left?

Mistakes to avoid

  • Using 1000 instead of 1024.
  • Forgetting to divide by 8 to get bytes.
  • Calling RLE lossy. It gives back the exact data.
  • Thinking lossy data can be restored. It cannot.

Check yourself

  1. How many KiB are in 9 MiB?
  1. How many bits are in 3 bytes?
  1. Encode the row of pixels RRRRGGB with run-length encoding.
  1. An image has its colour depth reduced to save space. Is this lossy or lossless?
  1. Give one benefit of compressing a file before sending it.

Sources

  • Cambridge International, IGCSE Computer Science 0478 syllabus for 2026 to 2028, section 1.3 (data storage and compression).
← All Notes
← Text, Sound and Images: Quick RevisionPackets and Data Transmission: Quick Revision →
More onComputer Science › Data Representation

Discussion (0)

Log in to join the discussion.

Loading…

On this page

  1. The units
  2. File sizes
  3. Compression
  4. A worked example
  5. Practice with new numbers
  6. A program to try
  7. Mistakes to avoid
  8. Check yourself
  9. Sources

Goes with the lesson

  1. Compression: lossy, lossless and run-length encodingStorage Units and Compression

More notes on this topic

  1. Text, Sound and Images: Quick Revision
  2. Number Systems: Quick Revision
  3. Logic Circuits and Truth Tables: Quick Revision
  4. NAND, NOR and XOR Gates: Quick Revision
  5. NOT, AND and OR Gates: Quick Revision
All notes on this topic →