1.1 UNITS OF DATA
What is a bit?
Definition: A bit (binary digit) is the smallest unit of data a computer can store. It holds a single value, either 0 or 1.
Key Points:
- A bit corresponds to a transistor being OFF (0) or ON (1).
- One bit alone can represent only two states, so we group bits together.
- 4 bits = a nibble; 8 bits = a byte.
- A single byte (8 bits) can represent 2⁸ = 256 different values (0 to 255).
Why This Matters: Every other unit of storage is built up from bits. File-size calculations always produce a number of bits first; you then divide to reach bytes, kilobytes and beyond. Mixing up bits and bytes is one of the most common ways to lose marks.
The units and the powers: The OCR J277 specification uses powers of 1000 (the decimal/SI convention), so each unit is 1000 times larger than the one before it.
| Unit | Symbol | Equals | Size in bytes |
|---|
| Bit | b | a single 0 or 1 | — |
| Nibble | — | 4 bits | — |
| Byte | B | 8 bits | 1 |
| Kilobyte | kB | 1000 bytes | 1 000 |
| Megabyte | MB | 1000 kB | 1 000 000 |
| Gigabyte | GB | 1000 MB | 1 000 000 000 |
| Terabyte | TB | 1000 GB | 1 000 000 000 000 |
Common Misconception: "A kilobyte is 1024 bytes."
- For OCR J277 you should use 1 kB = 1000 bytes. The 1024 figure (2¹⁰) belongs to the older binary convention (now called a kibibyte, KiB). Use 1000 in the exam unless a question explicitly tells you otherwise.
Exam tip: Learn the ladder both ways. To go up the units (B → kB → MB → GB → TB) you divide by 1000 each step. To go down you multiply by 1000. Write the chain of divisions out so the examiner can follow your unit conversion.
1.2 BINARY ↔ DENARY CONVERSION
The denary (base 10) system you already know
Definition: Denary (decimal) is the base-10 number system. Each column is worth ten times the column to its right: units, tens, hundreds, thousands.
The binary (base 2) system
Definition: Binary is the base-2 number system. It uses only the digits 0 and 1. Each column is worth twice the column to its right.
The 8-bit place values (read right to left, these are powers of 2):
| Place value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|
| Power | 2⁷ | 2⁶ | 2⁵ | 2⁴ | 2³ | 2² | 2¹ | 2⁰ |
Why This Matters: Binary is how all data is physically stored. Being able to convert in both directions quickly is an assumed skill — many longer questions (file sizes, addresses, colours) depend on it.
Binary → Denary
Method: Write the binary digits under the place-value headings, add up every place value that has a 1 above it.
Board-matched worked example: use the syntax and worked-output section above; the original OCR-centric code block has been replaced with board-aware examples.
So 10110101 = 181 in denary.
Denary → Binary
Method (subtraction): Starting from 128, ask of each place value "does it fit into what's left?" If yes, write 1 and subtract; if no, write 0.
Board-matched worked example: use the syntax and worked-output section above; the original OCR-centric code block has been replaced with board-aware examples.
Common Misconception: "I can leave off the leading zeros." If the question asks for an 8-bit answer, you must write all 8 bits, e.g. 01001011, not 1001011. Padding to the stated number of bits is often worth a mark.
Exam tip: Always show the place-value headings. Even if you make an arithmetic slip, the examiner can award method marks when your working is visible.
1.3 BINARY ADDITION AND OVERFLOW
Adding binary numbers
Definition: Binary addition works column by column like denary addition, but you carry whenever a column total reaches 2 (because 2 in binary is 10).
The four rules:
| Sum in a column | Write | Carry |
|---|
| 0 + 0 | 0 | 0 |
| 0 + 1 (or 1 + 0) | 1 | 0 |
| 1 + 1 | 0 | 1 |
| 1 + 1 + 1 (with carry in) | 1 | 1 |
Worked column addition:
Board-matched worked example: use the syntax and worked-output section above; the original OCR-centric code block has been replaced with board-aware examples.
Check: 91 + 54 = 145 ✓
Overflow
Definition: Overflow happens when the result of an addition needs more bits than the register (storage space) allows. The extra carry bit has nowhere to go, so it is lost and the stored answer is wrong.
Worked overflow example (8-bit register):
Board-matched worked example: use the syntax and worked-output section above; the original OCR-centric code block has been replaced with board-aware examples.
The true answer is 319, but only 8 bits are kept, so the stored value is 00111111 = 63 and the leading carry (the (1)) is dropped. This is an overflow error.
Why This Matters: Computers use fixed-size registers. Overflow explains real bugs — counters that wrap around, scores that suddenly go negative or to zero. The exam wants you to recognise and explain overflow, not just spot it.
Common Misconception: "Overflow means I did the addition wrong." No — the binary addition can be perfectly correct; overflow is a limitation of the storage size, not an arithmetic mistake.
Exam tip: If the answer to a binary addition has a carry out of the most-significant (leftmost) column, state explicitly: "An overflow error has occurred because the result requires 9 bits but only 8 are available."
1.4 BINARY SHIFTS
Definition: A binary shift moves all the bits in a binary number left or right by a given number of places. Gaps created at the end are filled with 0s, and bits pushed off the end are lost.
The effect:
| Shift | Direction | Effect on the value |
|---|
| Left shift by 1 | bits move left, 0 fills the right | multiplies by 2 |
| Left shift by n | — | multiplies by 2ⁿ |
| Right shift by 1 | bits move right, 0 fills the left | divides by 2 (whole-number / integer division) |
| Right shift by n | — | divides by 2ⁿ |
Worked left shift (×2):
Board-matched worked example: use the syntax and worked-output section above; the original OCR-centric code block has been replaced with board-aware examples.
Worked right shift (÷2):
Board-matched worked example: use the syntax and worked-output section above; the original OCR-centric code block has been replaced with board-aware examples.
Why This Matters: Shifting is extremely fast for a CPU — much faster than full multiplication or division — so it is used widely in real software for ×2 and ÷2 operations.
Common Misconception: "Bits that fall off the end come back round the other side." They do not — a standard (logical) shift discards the bits that drop off the end and fills the new gap with 0. This also means a right shift can lose precision: shifting 00000101 (5) right by 1 gives 00000010 (2), not 2.5 — the remainder is lost.
Exam tip: State both the operation and the result: "A left shift of 2 places multiplies the number by 4." If bits are lost, say so.
1.5 HEXADECIMAL
Definition: Hexadecimal (hex) is the base-16 number system. It uses sixteen symbols: the digits 0-9 and then the letters A, B, C, D, E, F to stand for the values 10-15.
The digit table:
| Denary | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
|---|
| Hex | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
| Binary (nibble) | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |
The key fact: One hex digit maps exactly onto one nibble (4 bits). So two hex digits = one byte.
Why hexadecimal is used
Key Points:
- Long strings of binary are hard for humans to read and easy to mis-copy.
11001010 is error-prone; CA is short and clear.
- Hex is much more compact: 8 bits become 2 hex digits.
- The conversion between binary and hex is trivial (group into nibbles), unlike binary↔denary.
- It is widely used in colour codes (e.g.
#FF0000 for red), memory addresses, MAC addresses and error/debug codes.
Why This Matters: Programmers don't use hex because it stores anything differently — the computer is still working in binary. Hex is purely a human-friendly shorthand for binary. Stating this is exactly what the exam wants.
Binary ↔ Hexadecimal
Method: Split the binary into nibbles (groups of 4, from the right), then convert each nibble to its single hex digit using the table.
Board-matched worked example: use the syntax and worked-output section above; the original OCR-centric code block has been replaced with board-aware examples.
To go from hex to binary, expand each digit into its 4-bit nibble: BE -> 1011 1110.
Hexadecimal ↔ Denary
Hex → Denary: Multiply the left digit by 16, multiply the right digit by 1, and add.
Board-matched worked example: use the syntax and worked-output section above; the original OCR-centric code block has been replaced with board-aware examples.
Denary → Hex: Divide by 16; the quotient is the first hex digit and the remainder is the second.
Board-matched worked example: use the syntax and worked-output section above; the original OCR-centric code block has been replaced with board-aware examples.
Common Misconception: "F means fifteen tens." No — in hex, F is a single digit worth 15, and in a two-digit number the left column is worth 16, not 10.
Exam tip: When converting binary↔hex, the safest route is always through nibbles. Don't try to go binary→denary→hex unless asked; the nibble method is faster and less error-prone.
1.6 CHARACTERS AND CHARACTER SETS
Definition: A character set is an agreed mapping that gives every character (letters, digits, punctuation, symbols, control codes) a unique binary code so text can be stored and exchanged.
ASCII
Key Points:
- ASCII (American Standard Code for Information Interchange) uses 7 bits, giving 2⁷ = 128 different characters.
- Usually stored in a byte (8 bits) with the extra bit unused or used for extension.
- Codes are ordered logically: e.g.
A = 65, B = 66 …; a = 97; 0 (the character) = 48.
- Because of this ordering, you can find the code of a later letter by counting up: if
A = 65 then D = 68.
Unicode
Key Points:
- Unicode uses more bits per character (commonly 16 or more), giving tens of thousands of code points.
- It can represent the characters of almost every world language, plus emoji and symbols.
- The first 128 Unicode code points are the same as ASCII, so ASCII text is valid Unicode.
- The cost is that each character takes more storage than in ASCII.
Soft comparison:
| Feature | ASCII | Unicode |
|---|
| Bits per character | 7 (stored in a byte) | 16+ (varies) |
| Number of characters | 128 | tens of thousands |
| Languages covered | English / basic Latin | almost all world languages, emoji |
| Storage per character | smaller | larger |
Why This Matters: Character sets are why the same text file opens correctly on any computer. The number of bits in the set directly limits how many distinct characters can exist — a classic exam link.
Common Misconception: "The letter A is stored as the actual shape A." It is stored as a binary number (65 in ASCII); the shape you see is drawn by the font from that code.
Exam tip: Be ready to explain why Unicode was developed: ASCII's 128 characters cannot represent non-English alphabets, so Unicode was created with more bits to cover all languages — at the cost of larger files.
1.7 REPRESENTING IMAGES
Definition: A bitmap image is stored as a grid of pixels (picture elements), where each pixel is a single colour stored as a binary number.
Key terms:
| Term | Meaning |
|---|
| Pixel | The smallest individual point of colour in an image. |
| Resolution | The number of pixels in the image, e.g. width × height (1920 × 1080). |
| Colour depth | The number of bits used to store each pixel. |
| Metadata | Extra data stored with the image: dimensions, colour depth, date, geolocation, etc. |
Colour depth and number of colours: A colour depth of n bits gives 2ⁿ possible colours per pixel.
| Colour depth (bits) | Number of colours (2ⁿ) |
|---|
| 1 | 2 (black & white) |
| 2 | 4 |
| 4 | 16 |
| 8 | 256 |
| 24 | 16 777 216 ("true colour") |
Why This Matters: Increasing resolution (more pixels) or colour depth (more bits per pixel) improves image quality but increases file size. This trade-off is a frequent exam theme, and metadata explains why a photo file is bigger than the raw pixel maths suggests.
Image file-size calculation
Formula:
Board-matched worked example: use the syntax and worked-output section above; the original OCR-centric code block has been replaced with board-aware examples.
Then divide by 8 for bytes, by 8000 for kilobytes, and so on.
Worked image size:
Board-matched worked example: use the syntax and worked-output section above; the original OCR-centric code block has been replaced with board-aware examples.
Common Misconception: "I always divide by 8 at the end." Only divide by 8 to convert bits → bytes, and only if the question asks for bytes (or a larger byte unit). If it asks for bits, leave it in bits.
Exam tip: Write the formula first, substitute the numbers, then convert units one step at a time. Keep units beside every number so you don't lose track of whether you're in bits or bytes.
1.8 REPRESENTING SOUND
Definition: Sound is analogue (a continuously varying wave). To store it, a computer takes measurements of the wave's height at regular intervals — this is sampling — and stores each measurement as a binary number.
Key terms:
| Term | Meaning |
|---|
| Sample | A single measurement of the amplitude (height) of the sound wave. |
| Sampling | Recording the wave's amplitude at regular time intervals. |
| Sample rate | How many samples are taken per second, measured in hertz (Hz). |
| Bit depth (sample resolution) | The number of bits used to store each sample. |
Key Points:
- A higher sample rate captures the wave more often, giving a more accurate (higher-quality) recording — but a bigger file.
- A higher bit depth records each sample more precisely (2ⁿ possible amplitude levels) — also a bigger file.
- A common CD sample rate is 44 100 Hz (44.1 kHz) at 16-bit depth.
Why This Matters: Sampling is a direct analogy to image resolution: more frequent / more precise samples = better quality = larger file. The exam loves the quality-vs-size trade-off.
Sound file-size calculation
Formula:
Board-matched worked example: use the syntax and worked-output section above; the original OCR-centric code block has been replaced with board-aware examples.
Then divide by 8 for bytes if required.
Worked sound size:
Board-matched worked example: use the syntax and worked-output section above; the original OCR-centric code block has been replaced with board-aware examples.
Common Misconception: "Sample rate and bit depth are the same thing." They are different: sample rate is how often you measure (per second); bit depth is how precisely you store each measurement. Both increase file size, for different reasons.
Exam tip: For mono vs stereo, multiply by the number of channels (2 for stereo) if the question states it. Otherwise assume one channel. Always show the formula and substitution.
1.9 COMPRESSION
Definition: Compression reduces the size of a file so it uses less storage and is quicker to transfer over a network. There are two types: lossless and lossy.
Lossless compression
Key Points:
- No data is lost — the original file can be reconstructed exactly.
- Works by storing data more efficiently, e.g. recording patterns rather than every value.
- Example technique: Run-Length Encoding (RLE), which stores a repeated value once with a count, e.g.
RRRRRRR -> 7R.
- Used where every bit matters: text documents, spreadsheets, program code, executable files.
Lossy compression
Key Points:
- Some data is permanently removed — detail judged less noticeable to humans is discarded.
- Produces much smaller files than lossless, but quality is reduced and the original cannot be perfectly restored.
- Used for photos (JPEG), music (MP3) and streamed video, where a small quality loss is acceptable.
Soft comparison:
| Feature | Lossless | Lossy |
|---|
| Data lost? | No — fully reversible | Yes — permanent |
| File size reduction | Smaller | Much smaller |
| Quality | Identical to original | Reduced |
| Typical uses | Text, code, spreadsheets, archives | Photos, music, streaming video |
Why This Matters: Choosing the right type is an applied (AO2) skill. A legal contract or program must be lossless — losing characters could change meaning or break the code. A music streaming service uses lossy to keep files small enough to stream quickly.
Common Misconception: "Lossy is just a worse version of lossless." They serve different needs. Lossy is the correct choice when smaller size matters more than perfect fidelity; lossless is the correct choice when no data may be lost. The right answer depends on the data type and context.
Exam tip: When asked to choose, always justify with the data type: "Lossless, because the file is a legal document and removing any characters could change its meaning." A bare choice with no justification scores poorly.