How is data stored and represented in a computer — from binary to images, and from RAM to hard drives?
Data Representation of Images
Data Representation of Images — real image files at 1, 4, 8 and 24-bit colour depth. Calculate the size, download the file, and check it to the exact byte.
Data Representation of Sound
Data Representation of Sound — real sound files at different sample rates and bit depths. Listen, calculate the size, download the file, and check it to the exact byte.
1.2 Memory and Storage — full topic revisionMr Moore
Videos remain on their creators' YouTube channels and are embedded, not copied. Practice pages link out to their own sites. Craig'n'Dave · Mr Moore · CSNewbs · 101 Computing.
All data inside a computer is ultimately stored as binary — sequences of 0s and 1s. A bit is the smallest unit; 8 bits make a byte; units scale by 1,000 from there (kilobyte → megabyte → gigabyte → terabyte → petabyte). The same binary digits can represent different things — a number, a character, part of an image — depending on context and encoding. ASCII and Unicode define how characters are encoded; image and sound files are binary sequences whose file size can be calculated from colour depth × resolution and sample rate × duration × bit depth respectively.
Memory sits in a hierarchy. Cache (tiny, very fast) feeds the CPU first; RAM (fast, volatile) holds running programs and data; secondary storage (slow, non-volatile — magnetic, optical, solid-state) holds everything else when the power is off. When RAM is full, the OS moves data to a virtual memory area on secondary storage — slower, but it prevents crashes. The choice of secondary storage type depends on the application: SSDs are fast but expensive; HDDs are slow but cheap and large; optical media (CD/DVD/Blu-ray) is portable but slow.
A 24-bit colour bitmap image has dimensions 1200 × 800 pixels. (a) Calculate the file size in bytes. (b) An audio file is recorded at 44,100 Hz, 16-bit depth, for 3 minutes. Calculate the uncompressed file size in MB. (c) Convert 11011010 from binary to denary. Convert 2D from hex to denary.
Compression: lossy (some data removed permanently, e.g. MP3, JPEG) vs lossless (data fully recoverable, e.g. PNG, ZIP)
Primary storage: RAM (volatile, fast, holds running programs) vs ROM (non-volatile, holds boot instructions)
Cache: very fast memory between CPU and RAM; hit/miss; larger cache → fewer slow RAM accesses
Virtual memory: overflow from RAM to secondary storage when RAM is full; slower but prevents crashes
Secondary storage: optical (CD/DVD/Blu-ray), magnetic (HDD), solid-state (SSD) — compare on capacity, speed, portability, durability, reliability, cost
Diagrams
A RAM module. Primary storage is fast and volatile, holding running programs and their data.Optical storage records data as pits and lands. Each transition between them is read as a 1.A bitmap is just binary. Each pixel's colour is stored as a binary value, here 1 bit per pixel.Sampling. The analogue wave is measured at regular intervals, and each sample is stored as a binary number.The ASCII character set. Each character maps to a 7-bit binary code.
Diagrams: PG Online (Paul Long), OCR J277 textbook. Used under the school site licence.
Linking questions
Where is data stored while the CPU is processing it? → §1.1 Systems Architecture (registers, cache)
What do compression utilities do, and why are they system software? → §1.5 Systems Software