Skip to content

9618 · Unit 1 · Paper 1: Theory fundamentals

Information representation.

9618 · Unit 1 · Information representation
Revisionbyexamplicity

Binary, denary and hexadecimal

§1.1 · Data representation · number systems

A computer keeps every value as a row of ons and offs: binary (base 2), easy for it and hard for us to read. People count in denary (base 10); programmers shorten binary to hexadecimal (base 16). All three write the same number.

Inside a computer every value is a pattern of ons and offs: binary (base 2). People count in denary (base 10), and programmers often write the shorter hexadecimal (base 16). All three write the same number.

Start from the bits at the top: they split into three groups of four, and each group becomes one hex digit.

20480102405120256112816413201608140211111C12B11Binary0001 1100 1011Hexadecimal1CBDenary459denary value of each nibble
Global binary place values above each bit2048010240512025611one hex digit1281641320160Cone hex digit81402111Bone hex digitSame value: 459 denary = 1CB hexadecimalEach group of four bits becomes one hex digit.

Three conversions, one example

Every card converts the same value, 459, so you see one number in all three bases. Be able to do each conversion in both directions.

Denary → binary

Write the place values. Subtract the largest that fits and write 1 under it; otherwise write 0.

459 − 256 = 203203 − 128 = 7575 − 64 = 1111 − 8 − 2 − 1 = 00001 1100 1011

Binary ↔ hexadecimal

Split the bits into groups of four from the right. Each group is one hex digit; pad the left group with 0s.

0001 → 11100 → C(12)1011 → B(11)1CB

Hexadecimal ↔ denary

To denary, multiply each digit by its place value (256, 16, 1). To hex, divide by 16 repeatedly and read the remainders upwards.

1 × 256 + 12 × 16 + 11 = 459459 ÷ 16 = 28 r 11B28 ÷ 16 = 1 r 12C1 ÷ 16 = 0 r 111CB

How many values can n bits hold?

Each extra bit doubles the number of patterns. Read a row of the table for one bit width; the card goes the other way, from a count of values to the bits it needs.

UnsignedDifferent patternsDenary rangeLargest in hex
4 bits24 = 160 to 15F
8 bits28 = 2560 to 255FF
12 bits212 = 4 0960 to 4 095FFF
16 bits216 = 65 5360 to 65 535FFFF

Minimum number of bits

  1. 1
    n bits give 2ⁿ patterns; the largest unsigned value is 2ⁿ − 1.
  2. 2
    For k different values, find the smallest n with 2ⁿ ≥ k.
  3. 3
    128 values (0 to 127) need 7 bits; the number 128 itself needs 8.
  4. 4
    40 000 values need 16; 5 000 000 need 23.
Your turn

1 Convert 182 to 8-bit binary, then to hexadecimal.

2 Convert the hexadecimal 3E to denary.

3 How many bits are needed to store 300 different values?

4 What is the largest unsigned value 10 bits can hold?

  1. 1
    1011 0110, so B6: 1011 → B, 0110 → 6
  2. 2
    3 × 16 + 14 = 62
  3. 3
    9: 2⁸ = 256 is too few, 2⁹ = 512 is enough
  4. 4
    2¹⁰ − 1 = 1023
Tick what you can do now
Exam focusShow the working the question asks for (dividing by 16, or converting through binary) and keep the bit width it states: 171 in 12-bit binary is 0000 1010 1011, leading zeros included. One hex digit is four bits.
Practise with s25/12 Q2(a); s26/12 Q5(a); s26/13 Q6(a); w25/13 Q2(a)
1 / 16
9618 · Unit 1 · Information representation
Revisionbyexamplicity

Binary magnitudes and prefixes

§1.1 · Data representation · binary and decimal prefixes

A single photo holds millions of bits, so nobody counts them one at a time. A bit is one binary digit; 4 bits make a nibble and 8 make a byte. Bigger amounts take a prefix, and two sets of prefixes sound alike but name different sizes: binary (powers of 2) and decimal (powers of 10).

Follow the ladder from bit to TiB: the number under each arrow is how many of one unit make the next.

bit0 or 1× 4nibble4 bits× 2byte8 bits× 1024KiB1024 bytes× 1024MiB1024 KiB× 1024GiB1024 MiB× 1024TiB1024 GiB
bit0 or 1× 4nibble4 bits× 2byte8 bits× 1024KiB1024 bytes× 1024MiB1024 KiB× 1024GiB1024 MiB× 1024TiB1024 GiB

Decimal prefixes count in 1000s; binary prefixes count in 1024s

Prefixes that sound alike can name different sizes: a kibibyte is 24 bytes more than a kilobyte. Be able to name both prefixes in a row and give each one’s size in bytes.

Decimal prefixBytesBinary prefixBytes
kilo (kB)103 = 1 000kibi (KiB)210 = 1 024
mega (MB)106 = 1 000 000mebi (MiB)220 = 1 048 576
giga (GB)109 = 1 000 000 000gibi (GiB)230 = 1 073 741 824
tera (TB)1012 = 1 000 000 000 000tebi (TiB)240 = 1 099 511 627 776
DecimalBinary
kilo (kB)
103 = 1 000 bytes
kibi (KiB)
210 = 1 024 bytes
mega (MB)
106 = 1 000 000 bytes
mebi (MiB)
220 = 1 048 576 bytes
giga (GB)
109 = 1 000 000 000 bytes
gibi (GiB)
230 = 1 073 741 824 bytes
tera (TB)
1012 = 1 000 000 000 000 bytes
tebi (TiB)
240 = 1 099 511 627 776 bytes
Compare a prefix with its partner in the same row: a mebibyte holds 1024 kibibytes, while a megabyte holds 1000 kilobytes. Each binary step multiplies by 2¹⁰ = 1024; each decimal step by 10³ = 1000.

Worked conversions

The first two cards start from the same 2 and end 777 216 bits apart, because one prefix steps by 1024 and the other by 1000.

2 MiB in bits

2 × 1024 × 1024= 2 097 152 bytes× 8 = 16 777 216 bits

2 MB in bits

2 × 1000 × 1000= 2 000 000 bytes× 8 = 16 000 000 bits

4.5 MiB photos on 16 GiB

16 × 1024 = 16 384 MiB16 384 ÷ 4.5 = 3640.893640 whole photos
  • Bits to bytes: ÷ 8. Then ÷ 1024 for each binary prefix step, or ÷ 1000 for each decimal step.
  • Use the prefix the question names.
  • To compare sizes, convert to the same unit first: 2 MiB is 2 097 152 bytes, more than 2 MB (2 000 000 bytes).
Your turn

1 How many bytes are in 3 KiB?

2 How many bits are in 5 MB?

3 Which is larger, 1 GiB or 1 GB? By how many bytes?

4 How many whole 2.5 MiB files fit in 1 GiB?

  1. 1
    3 × 1024 = 3 072 bytes
  2. 2
    5 × 1000 × 1000 × 8 = 40 000 000 bits
  3. 3
    1 GiB, by 1 073 741 824 − 1 000 000 000 = 73 741 824 bytes
  4. 4
    1024 ÷ 2.5 = 409.6, so 409 whole files
Tick what you can do now
Exam focusCompare corresponding prefixes (kibi with kilo, mebi with mega). Naming the digits each number system uses does not explain the difference: give the step size, powers of 2 (1024) against powers of 10 (1000).
Practise with s26/11 Q1(d); s24/12 Q7(a)
2 / 16
9618 · Unit 1 · Information representation
Revisionbyexamplicity

Hexadecimal in use

§1.1 · Data representation · practical uses of hexadecimal

A row of thirty-two 0s and 1s is easy to misread and hard to copy. Hexadecimal is a shorthand for binary: one hex digit stands for exactly four bits, so that row shrinks to eight digits. It is used wherever people need to read, write or check long binary values.

The sixteen hex digits

Read the strip down each column: a hex digit, its four bits and its denary value. Converting is swapping a digit for its column.

Hex
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
Binary
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
Denary
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
HexBinaryDenary
000000
100011
200102
300113
401004
501015
601106
701117
HexBinaryDenary
810008
910019
A101010
B101111
C110012
D110113
E111014
F111115

Practical applications of hexadecimal

Hex turns up wherever people handle long binary values by eye, from web colours to network cards. Be able to give a use and say why hex suits it.

Where hexadecimal is usedWhy hex is used
Memory addresses and memory dumpsa long address or a block of memory contents is far shorter to read and check
Colour codes in web pages and graphics#D9752B is three pairs of hex digits: red D9, green 75, blue 2B
MAC addresses and IPv6 addresses48-bit and 128-bit values become 12 and 32 hex digits
Machine code, assembly and error codesa programmer can read and debug the values with fewer mistakes

Read a colour code and a MAC address

A colour code

#D9752B
D9 → 13 × 16 + 9 = 217red75 → 7 × 16 + 5 = 117green2B → 2 × 16 + 11 = 43blueD9 = 1101 1001each digit → 4 bits

A MAC address

00:1A:2B:3C:4D:5E

12 hex digits stand for the 48-bit address. Written in binary it would be 48 digits long.

Hexadecimal is for people. The computer still stores the bits, so writing a value in hex saves no memory.
Your turn

1 A web page uses the colour #3C8F1A. What is its red value in denary?

2 Write the hex value 7E as 8 bits.

3 A memory address is 32 bits long. How many hex digits does it take?

4 Why does a technician read a memory dump in hex rather than in binary?

  1. 1
    3C → 3 × 16 + 12 = 60
  2. 2
    7 → 0111, E → 1110: 0111 1110
  3. 3
    32 ÷ 4 = 8
  4. 4
    hex is four times shorter, so it is quicker to read and fewer digits are miscopied
Tick what you can do now
Exam focusGive the use and the reason hex suits it: it is shorter than binary, so a person reads it faster and miscopies it less. Convert hex to binary one digit at a time: each digit is four bits.
Practise with s26/11 Q1(a)(i); s25/13 Q1(c)(ii); s25/12 Q6(c)
3 / 16
9618 · Unit 1 · Information representation
Revisionbyexamplicity

Binary coded decimal (BCD)

§1.1 · Data representation · binary coded decimal

A digital clock shows each digit on its own, so it can store them that way too. Binary coded decimal (BCD) gives each denary digit its own 4-bit code; the number is never converted as a whole.

Each digit of 409 gets its own four bits. Under the boxes, compare that with 409 converted as a whole.

401000000091001409 in BCD = 0100 0000 1001 (12 bits) · 409 in binary = 110011001 (9 bits)
401000000091001BCD: 0100 0000 1001 · 12 bitsWhole-number binary: 110011001 · 9 bits

The same bits, read two ways

One pattern, two numbers: say which reading you are using before you work out a value.

Read 0100 1001 as…WorkingValue
unsigned binary64 + 8 + 173
BCD0100 → 4, 1001 → 949

Binary → BCD

Convert the binary to denary first, then code each denary digit:

10110111 = 128 + 32 + 16 + 4 + 2 + 1= 1831 → 0001, 8 → 1000, 3 → 00110001 1000 0011

Do not confuse

A BCD nibble only holds 0000 to 1001 (0–9). 1010 to 1111 are not BCD digits, so 0110 1011 cannot be BCD: its second nibble, 1011, is 11.

Practical applications of BCD

BCD takes more bits than plain binary, so it is chosen only where keeping each denary digit separate helps. Be able to give an application and a reason that fits that application.

ApplicationWhy BCD suits it
Calculator, clock or meter displayEach position on the display shows one denary digit, so each 4-bit code drives one position directly, with no conversion of the whole number.
Money in a till or a bank accountDecimal digits are held exactly. A decimal fraction such as 0.10 has no exact finite binary fraction, so storing fractional amounts that way can introduce rounding errors.
Date and time kept by a PC's BIOS clockEach digit of the time has its own nibble, so it is read, shown and set digit by digit, and turned into denary simply.
Barcode systemsEach printed digit maps to its own 4-bit code, making conversion back to the denary digits straightforward.
Your turn

1 Write 75 in BCD.

2 Which denary number is the BCD code 0011 1000 0110?

3 Can 1001 1100 be a BCD code? Give the reason.

4 Write the binary number 0101 1010 in BCD.

  1. 1
    7 → 0111, 5 → 0101: 0111 0101
  2. 2
    0011 → 3, 1000 → 8, 0110 → 6: 386
  3. 3
    no: the second nibble, 1100, is 12, above 9
  4. 4
    0101 1010 = 90, so 1001 0000
Tick what you can do now
Exam focusGive the application and a justification that fits it: an electricity meter shows one digit in each position, so each 4-bit code feeds one position. Explain what is straightforward: conversion or driving a digit display.
Practise with s25/12 Q2(c); s26/12 Q5(a); s26/13 Q6(a); w21/12 Q4(d) (older paper: invalid BCD digit)
4 / 16
9618 · Unit 1 · Information representation
Revisionbyexamplicity

One’s and two’s complement

§1.1 · Data representation · signed binary integers

Plain binary only counts up from 0, but a bank balance or a temperature can drop below zero, and a byte has no minus sign. A signed integer can be negative. In one’s complement a negative is the positive number with every bit flipped; in two’s complement every bit is flipped, then 1 added.

Where the negative numbers sit

Laid out in denary order, the 256 patterns of 8-bit two’s complement split into a negative half and a positive half. Be able to tell the sign from the first bit.

sign bit 1: negativesign bit 0: zero or positive1000 0000−1281000 0001−127…1101 0011−45…1111 1111−10000 000000000 0001+1…0111 1111+127In denary order: the values run from −128 up to −1, then 0 up to +127.
sign bit 1: negative1000 0000−1281000 0001−127⋮1101 0011−45⋮1111 1111−1sign bit 0: zero or positive0000 000000000 0001+1⋮0111 1111+127

Convert in both directions

One route each way: build −45 from +45, then read 1101 0011 back by giving its left bit the value −128.

Denary → two’s complement

1 Write +45001011012 Invert every bit110100103 Add 111010011

Step 2 alone gives the one’s complement of +45: 11010010 = −45 in one’s complement.

Two’s complement → denary

−128164132016180402111
−128 + 64 + 16 + 2 + 1 = −45

Method 1: the most significant bit has a negative place value; add the place values that hold a 1.

Method 2: invert and add 1 to find the size: 00101100 + 1 = 00101101 = 45, so the value is −45.

Compare the three representations

Each form gives up something: negative numbers, a wider range, or a single zero. Be able to give the range, the zeros and how a negative is formed for each.

8-bit formRangeZeroNegative numbers
Unsigned0 to 255one zeronot represented
One’s complement−127 to +127two: 00000000 and 11111111invert every bit of the positive value
Two’s complement−128 to +127one: 00000000invert every bit, then add 1

Two more facts come from the two’s complement row: how to widen a number, and the range for any number of bits.

Widening a two’s complement number

Copy the sign bit into the new places. 1101 (−3 in 4 bits) becomes 1111 1101 (−3 in 8 bits); 0101 becomes 0000 0101.

Limits in n bits

Two’s complement covers −2ⁿ⁻¹ to +2ⁿ⁻¹ − 1. Smallest: 1 then all 0s; largest: 0 then all 1s. 8 bits: 1000 0000 = −128 to 0111 1111 = +127. 16 bits: −32 768 to +32 767.

Your turn

1 Write −20 in 8-bit two’s complement.

2 Which denary value is the two’s complement number 1011 0110?

3 Write −20 in 8-bit one’s complement.

4 Widen the 4-bit two’s complement number 1010 to 8 bits. What value does it hold?

  1. 1
    +20 = 0001 0100 → invert 1110 1011 → add 1: 1110 1100
  2. 2
    −128 + 32 + 16 + 4 + 2 = −74
  3. 3
    1110 1011: invert only
  4. 4
    copy the sign bit: 1111 1010, still −6
Tick what you can do now
Exam focusShow the working: write the positive value, invert, then add 1 for two’s complement. Never put a minus sign in front of the binary, and always write the full number of bits.
Practise with s25/12 Q2(b)(i), (b)(ii); s26/12 Q5(b); w24/13 Q8(b); s23/12 Q4(b) (older paper: one's complement)
5 / 16
9618 · Unit 1 · Information representation
Revisionbyexamplicity

Binary addition, subtraction and overflow

§1.1 · Data representation · binary arithmetic

Binary sums work like the column sums you already know, with only two digits. Add column by column from the right: 1 + 1 = 10, so write 0 and carry 1. Subtract by adding the two’s complement. The catch is the fixed number of bits: overflow happens when the result needs more bits than there are.

Add from the right, carrying to the left

Learn the four rules, then follow them through two 8-bit sums that both run out of room, in different ways.

Rules

0 + 0 = 0
write 0
0 + 1 = 1
write 1
1 + 1 = 10
write 0, carry 1
1 + 1 + 1 = 11
write 1, carry 1

Unsigned: 200 + 100

1
11001000
+01100100
100101100

300 needs 9 bits. The ninth bit has nowhere to go: overflow. The 8 bits that remain hold 44.

Two’s complement: 100 + 40

11
01100100
+00101000
10001100

Two positive numbers give a result starting with 1, which reads as −116: overflow, because +140 is above +127.

For three numbers, add the first two, then add the third to that result. Show both sets of binary working and keep any carry-out bits the question requests.

Two ways to subtract

A computer subtracts by adding the two’s complement; on paper you can also borrow, as in denary column subtraction.

Subtract by adding: 94 − 37

Form −37: 00100101 → invert → +1 → 11011011. Then add.

11111
01011110
+11011011
100111001

The carry out of the left-most column (struck through) is discarded, not overflow: the answer is +57.

Direct subtraction: 113 − 46

111
01110001
−00101110
01000011

Where a column has 0 − 1, borrow from the next column to the left (marked 1 above it). The answer is 0100 0011 = 67.

Follow 94 + (−37) one column at a time

Most slips happen in the carries, so follow one sum slowly. Each row is one column, named by its place value; start at the 1 column. A row adds two bits and the carry in, writes one bit and carries the rest left. The highlighted column uses 1 + 1 + 1 = 11.

94−37Carry inWriteCarry outWhat happens in the column
10110 + 1 = 1: write 1
0 + 1 = 1: write 1
211011 + 1 = 10: write 0, carry 1
1 + 1 = 10: write 0, carry 1
4101011 + 0 + carry 1 = 10: write 0, carry 1
1 + 0 + carry 1 = 10: write 0, carry 1
8111111 + 1 + carry 1 = 11: write 1, carry 1
1 + 1 + carry 1 = 11: write 1, carry 1
16111111 + 1 + carry 1 = 11: write 1, carry 1
1 + 1 + carry 1 = 11: write 1, carry 1
3200110 + 0 + carry 1 = 1: write 1
0 + 0 + carry 1 = 1: write 1
6411011 + 1 = 10: write 0, carry 1
1 + 1 = 10: write 0, carry 1
128011010 + 1 + carry 1 = 10: write 0, carry 1; the carry out is discarded
0 + 1 + carry 1 = 10: write 0, carry 1; the carry out is discarded

Overflow

  • The result is too large (or too small) to fit in the bits available, so the stored value is wrong.
  • Unsigned: a carry out of the most significant bit, as in 200 + 100.
  • Two’s complement: two numbers with the same sign give a result with the opposite sign, as in 100 + 40. A carry out when subtracting by adding is discarded and is not overflow.
Your turn

1 Add 0101 0111 + 0010 1101.

2 Read your answer to question 1 as an 8-bit two’s complement number. Has overflow happened?

3 In 8-bit unsigned binary, 190 + 85 is worked out. What is stored, and why is it wrong?

4 Work out 75 − 28 by adding the two’s complement of 28.

  1. 1
    1000 0100
  2. 2
    yes: two positive numbers gave a result starting with 1, which reads as −124; +132 is above +127
  3. 3
    0001 0011 = 19: 275 needs 9 bits, so the carry out is lost (overflow)
  4. 4
    −28 = 1110 0100; 0100 1011 + 1110 0100 = (1) 0010 1111 = 47; the carry out is discarded
Tick what you can do now
Exam focusWhen binary working is requested, show the carries or borrows. A denary conversion can check the answer but does not show that binary method. When asked, include the carry out of the left-most column in brackets: (1) 0011 1001.
Practise with s25/13 Q7(b), (c); s24/13 Q1(c); s26/11 Q1(c); s24/11 Q7; w24/11 Q1(d)
6 / 16
9618 · Unit 1 · Information representation
Revisionbyexamplicity

Character sets

§1.1 · Data representation · character data

A computer can only store numbers, so to keep a letter it stores a number that stands for it. A character set lists every character a computer can represent and gives each one a unique binary code.

Text is stored as a sequence of character codes

The computer swaps every character for its code and keeps the codes in sequence, in the order of the text.

C
code 67 · position 1 · shown in 8 bits
01000011
a
code 97 · position 2 · shown in 8 bits
01100001
t
code 116 · position 3 · shown in 8 bits
01110100
You never need to memorise character codes: the question gives any you need. A digit typed as text, such as '7', is stored as its character code (55), not as the binary value 7.

ASCII, extended ASCII and Unicode

Seven bits are enough for English but not for the world’s scripts, which is why there are several sets. Be able to compare them: bits per character, how many characters, and what they cover.

Character setBits per characterCharactersCovers
ASCII72⁷ = 128English letters, digits, punctuation and control characters
Extended ASCII82⁸ = 256ASCII plus extra symbols and some accented letters
Unicodeup to 32, depending on encodingfar morecharacters from many languages, plus symbols and emojis; includes all the ASCII characters
SetBits, characters and coverage
ASCII7 bits · 2⁷ = 128 characters
English letters, digits, punctuation and control characters
Extended ASCII8 bits · 2⁸ = 256 characters
ASCII plus extra symbols and some accented letters
Unicodeup to 32 bits, depending on encoding · far more characters
characters from many languages, plus symbols and emojis; includes all the ASCII characters

What every set shares, and what changes as the sets grow:

Alike

  • In either set, every character is given its own unique binary code.
  • The first 128 Unicode codes are the ASCII codes: ASCII is a subset of Unicode.
  • An English letter can take 8 bits in either (Unicode’s 8-bit encoding).

Different

  • Unicode allows up to 32 bits for a character; ASCII has 7, or 8 when extended.
  • More bits give far more codes, so Unicode covers the scripts of many languages, plus emojis.
  • The cost: the same text can need more storage in Unicode.
Your turn

1 In ASCII the code for 'A' is 65. What is the code for 'E'? Write it in 8 bits.

2 How many bits does the word “Hello” take in 8-bit ASCII?

3 In ASCII the digit '7' has the code 55. What is the code for '9'?

4 A messaging app must send Greek and Thai text. Why does it use Unicode, not ASCII?

  1. 1
    69: 0100 0101
  2. 2
    5 characters × 8 bits = 40 bits
  3. 3
    57: the digits have consecutive codes
  4. 4
    ASCII has only 128 (or 256) codes, mostly English; Unicode uses more bits, so it has codes for the characters of many languages
Tick what you can do now
Exam focusDescribe stored text in three steps: the set gives every character a unique code; the text is written as the code for each of its characters; those codes are kept in sequence. Say what Unicode adds and why: more bits per character, so more languages and symbols.
Practise with s24/13 Q1(d)(i); s25/11 Q3(b)(i); s21/12 Q6(b) (older paper: text sequence); w22/11 Q1(c) (older paper: character-set comparison)
7 / 16
9618 · Unit 1 · Information representation
Revisionbyexamplicity

Bitmap images: how the data is encoded

§1.2 · Multimedia · graphics

Zoom right into a photo and you see tiny squares of colour. A bitmap image is a grid of these pixels, and every pixel is one colour. Each colour the image uses has its own unique binary code, and the file holds the code for every pixel, one after another in sequence.

Match each square to its code in the key, then find that code in the pixel data: the top row reads 00 00 01 01 10 10.

6 × 4 pixels000110File headerfile type: bitmapwidth 6, height 4 pixelscolour depth 2 bitscompression: noneoffset to the pixel dataPixel data, in order00 00 01 01 10 1000 01 01 10 10 0001 01 10 10 00 0001 10 10 00 00 01one 2-bit code per pixel, row by rowPixel data: 6 × 4 pixels × 2 bits = 48 bits.Three colours need 2 bits, because 1 bit gives only 2 codes.
6 × 4 pixels · one colour per pixel000110File headerType: bitmap · width 6, height 4 pixelsColour depth: 2 bits · compression: noneOffset: where the pixel data beginsPixel data: same row order as the imageRow 1:00 00 01 01 10 10Row 2:00 01 01 10 10 00Row 3:01 01 10 10 00 00Row 4:01 10 10 00 00 016 × 4 × 2 = 48 bits of pixel data

Terms to use precisely

Image resolution and screen resolution sound alike but mean different things, so each term needs its exact meaning. Be able to define each one, keeping the words in bold.

TermMeaning
Pixelthe smallest addressable part of an image: one square that holds one colour
File headerinformation that describes the image, stored before the pixel data: file type, file size, width and height, colour depth, compression type, where the pixel data starts
Image resolutionthe image’s size in pixels: its width in pixels × its height in pixels
Screen resolutionthe width × height in pixels that a screen can display
Colour depth (bit depth)how many bits each pixel uses for its colour; n bits give 2ⁿ possible colours

Two mix-ups to avoid:

Image or screen resolution?

Changing the screen resolution does not change the stored image. A screen with fewer pixels than the image cannot show every one of them, so the picture looks less sharp.

Do not confuse

A pixel is the picture element, not its binary code. The header describes the image; it does not hold the pixel colours.

Your turn

1 An image uses 9 different colours. What is the smallest colour depth it can have?

2 An image is 10 pixels wide and 8 high, with a colour depth of 1 bit. How many bits of pixel data does it have?

3 Which part of the file tells the software how wide the image is?

4 In the figure, which colour is the third pixel of the top row, and what code is stored for it?

  1. 1
    4 bits: 3 bits give only 8 codes, 4 bits give 16
  2. 2
    10 × 8 × 1 = 80 bits
  3. 3
    the file header
  4. 4
    pale blue: 01
Tick what you can do now
Exam focusTo explain bitmap encoding, give all three ideas: an image built from pixels of one colour each, a unique binary code for each colour, and those codes in sequence. For resolution, give pixels wide × high; a total pixel count is not enough.
Practise with s24/12 Q2(d)(i); s26/12 Q1(b), (c); s26/11 Q5(a)
8 / 16
9618 · Unit 1 · Information representation
Revisionbyexamplicity

Bitmap images: file size and quality

§1.2 · Multimedia · graphics

Every pixel costs the same number of bits, so the size of a bitmap is easy to predict. The file size is width × height × colour depth in bits. Then convert to the unit you need.

Estimate the file size

Three images, one method: each card multiplies the same three things, and the amber card shows the trap when the depth is already in bytes. All are uncompressed pixel data, without the header unless a header size is given.

For uncompressed pixel data, multiply the number of pixels by the bits per pixel, then convert to the unit the question asks for. The estimate excludes the header unless a header size is given.

Answer in mebibytes

2048 × 768 pixels · 4 bits per pixel
width × height × colour depth
2048 × 768 = 1 572 864 pixels× 4 = 6 291 456 bits÷ 8 = 786 432 bytes÷ 1024 ÷ 1024 = 0.75 MiB

Answer in megabytes

3 million pixels · bit depth 12 bits
pixels × bits per pixel
3 000 000 × 12= 36 000 000 bits÷ 8 = 4 500 000 bytes÷ 1000 ÷ 1000 = 4.5 MB

Depth given in bytes

3000 × 2000 pixels · 3 bytes per pixel
already bytes: no ÷ 8
3000 × 2000 × 3= 18 000 000 bytes÷ 1000 ÷ 1000= 18 MB

Effects of changing a bitmap

Most changes trade picture quality against file size. Be able to say what each change does to the image and to the file size, and why.

ChangeEffect on the imageEffect on the file size
Increase the image resolutionmore pixels can record finer detail and reduce pixelationlarger: more pixels to store
Decrease the image resolutionfewer pixels, so detail is lostsmaller: fewer pixels to store
Increase the colour depthmore colours available, so recorded colours can be closer to the originallarger: more bits for every pixel
Decrease the colour depthfewer colours available, so detail is lostsmaller: fewer bits for every pixel
Double the width and the height4 × as many pixels4 × as large (same depth)
Repaint one area in a different colourthe picture looks differentno change: the same pixels, the same bits each
Show the image on a screen with more or fewer pixelsthe display changes, the stored image does notno change
If the question gives a maximum number of colours, find the bit depth first: 16 colours need 4 bits because 2⁴ = 16. Then multiply width × height × bits per pixel. Lower depth uses fewer bits per pixel, so the file is smaller and fewer colours can be shown.
Your turn

1 An image is 1024 × 512 pixels with a colour depth of 8 bits. What is its file size in KiB?

2 An image may use up to 64 colours. What colour depth does it need?

3 The width and the height of an image are both halved. What happens to the file size?

4 An image is 1000 × 500 pixels with 2 bytes per pixel. What is its size in MB?

  1. 1
    1024 × 512 × 8 = 4 194 304 bits ÷ 8 = 524 288 bytes ÷ 1024 = 512 KiB
  2. 2
    6 bits: 2⁶ = 64
  3. 3
    a quarter of the pixels, so a quarter of the size
  4. 4
    1000 × 500 × 2 = 1 000 000 bytes (already bytes: no ÷ 8) ÷ 1000 ÷ 1000 = 1 MB
Tick what you can do now
Exam focusCheck whether the depth is in bits or bytes (2 bytes = 16 bits) and use the unit asked for: MiB ÷ 1024 twice, MB ÷ 1000 twice. For an effect, give the mechanism (more or fewer pixels, bits per pixel), not just “bigger”.
Practise with s25/13 Q1(a)(i), (a)(ii); s24/13 Q2(a); w24/12 Q7(a)(ii); w25/11 Q7(d)(i); w22/12 Q8(a) (older paper: recolouring and display changes)
9 / 16
9618 · Unit 1 · Information representation
Revisionbyexamplicity

Bitmap sequences: counting frames and file size

§1.2 · Multimedia · graphics

An animation is a flick-book of still bitmaps, called frames, shown fast enough to look like movement. Take the 2048 × 768 image you sized earlier, with 4 bits per pixel, and make every frame that size. It plays 12 frames each second for 3 seconds.

Uncompressed pixel data only: all frames have the same dimensions and depth; ignore file/frame headers. This sequence has no sound track.

Each box is one frame of 0.75 MiB: a row is one second of 12 frames, and three rows make the 3 seconds.

one frame = 0.75 MiBsecond 112 framessecond 212 framessecond 312 frames3 seconds × 12 frames = 36 frames; 36 × 0.75 MiB = 27 MiB
one frame = 0.75 MiBs1s2s33 seconds × 12 frames = 36 frames36 × 0.75 MiB = 27 MiB

Size per frame × number of frames

1 · Size of one frame

2048 × 768 = 1 572 864 pixels× 4 = 6 291 456 bits4 bits per pixel÷ 8 = 786 432 bytes÷ 1024 ÷ 1024 = 0.75 MiBper frame

2 · Count and combine the frames

12 frames/s × 3 s = 36 frames786 432 × 36 = 28 311 552 bytes÷ 1024 ÷ 1024 = 27 MiBwhole sequenceCheck: 0.75 MiB × 36 = 27 MiBsame result

Choose the right factors

A question may give the number of frames, or the frame rate and the length, and may add headers or sound. Each needs a different step. Be able to choose which factor each given value needs.

GivenWhat to do
A number of framesmultiply the one-frame size by that count
Frames per second and durationfirst multiply frames/s × seconds to count frames
Depth in bytes rather than bitsthe per-frame result is already bytes: do not divide by 8 again
A sound track or stated headerscalculate those separately and add them in the same units
Your turn

1 A clip is 800 × 600 pixels with 8 bits per pixel. How many bytes is one frame?

2 The clip plays 25 frames each second for 4 seconds. How many frames is that?

3 What is the size of the whole clip in MB?

4 The same clip is stored with 2 bytes per pixel instead. What is its size in MB?

  1. 1
    800 × 600 × 8 = 3 840 000 bits ÷ 8 = 480 000 bytes
  2. 2
    25 × 4 = 100 frames
  3. 3
    480 000 × 100 = 48 000 000 bytes = 48 MB
  4. 4
    800 × 600 × 2 = 960 000 bytes a frame × 100 = 96 MB
Tick what you can do now
Exam focusKeep one frame separate from the whole sequence. Frames per second is a rate, so multiply by the number of seconds before multiplying the frame size.
Practise with w25/13 Q7(b); s26/13 Q3(b)(ii)
10 / 16
9618 · Unit 1 · Information representation
Revisionbyexamplicity

Vector graphics

§1.2 · Multimedia · graphics

A logo has to look sharp on a business card and on the side of a bus. A vector graphic does not store pixels. It stores a drawing list: a description of each object, from which the image is calculated whenever it is displayed, at whatever size it is needed.

Match each shape on the grid to its entry in the drawing list: the entry holds coordinates and settings, never pixels.

(0, 0) is top left · grid every 10 unitsDrawing listRectanglecorner (10, 55) · width 40 · height 30fill pale blue · line blue · line width 2Circlecentre (70, 30) · radius 15fill pale violet · line violet · line width 2Linestart (15, 20) · end (45, 40)line brown · line width 3Each entry: one drawing object, its coordinates and its properties.
(0, 0) top left · grid every 10 unitsRectanglecorner (10,55); width 40; height 30pale blue fill; blue outline; line width 2Circlecentre (70,30); radius 15pale violet fill; violet outline; line width 2Linestart (15,20); end (45,40)brown line; width 3

Drawing object

One shape or piece of text in the image: a line, a rectangle, a circle or a letter.

Property

A setting that fixes how one drawing object looks: its fill colour, line colour, line width or font.

Drawing list

Every drawing object in the image, each stored with the command and the property values that draw it.

What the drawing list stores for each object

The drawing list is all a vector file holds, so everything you see on screen has to be written in it. Be able to name properties for an object and say what else its entry stores.

ObjectProperties (its appearance)Also in the drawing list (where and how big)
Lineline colour, line width, style (solid, dashed)start and end coordinates
Rectanglefill colour, line colour, line widthcorner position, width, height
Circlefill colour, line colour, line widthcentre coordinates, radius
Textfont, font size, colourthe characters and their position
ObjectAppearance and geometry
Lineline colour, line width, style (solid, dashed)
start and end coordinates
Rectanglefill colour, line colour, line width
corner position, width, height
Circlefill colour, line colour, line width
centre coordinates, radius
Textfont, font size, colour
the characters and their position
Scaling recalculates the coordinates and sizes, so the edges stay smooth at any size.
Your turn

1 Give two properties of the circle in the drawing list.

2 The whole image is enlarged 2 times from (0, 0). Give the rectangle’s new corner, width and height.

3 Which object in the drawing list has no fill colour, and why?

4 Why do the edges stay sharp when a vector graphic is enlarged?

  1. 1
    any two of: fill colour (pale violet), line colour (violet), line width 2
  2. 2
    corner (20, 110), width 80, height 60
  3. 3
    the line: it encloses no area to fill, so it has only a line colour and a line width
  4. 4
    the shapes are drawn again from the new coordinates, not by making pixels bigger
Tick what you can do now
Exam focusUse the three terms exactly: drawing object, property, drawing list. Give appearance properties as examples (fill colour, line colour, line width). “A vector stores equations” on its own misses the drawing list.
Practise with s24/12 Q2(d)(ii); s26/11 Q5(b)
11 / 16
9618 · Unit 1 · Information representation
Revisionbyexamplicity

Bitmap or vector: justify the choice

§1.2 · Multimedia · graphics

Neither kind of image is better everywhere. A bitmap stores every pixel, which suits a photograph; a vector graphic stores a drawing list, which suits shapes that must scale. Choose by what the image shows and how it will be used.

Both images started as the same small circle and were enlarged by the same amount.

Bitmap enlarged: the pixels get biggerVector enlarged: the shape is recalculated
Bitmap enlargedpixels get biggerVector enlargedshape recalculated

Compare the same feature for both

A comparison is only clear when both halves talk about the same feature. Be able to give each difference as a pair: a bitmap …, whereas a vector graphic ….

BitmapVector graphic
What is storeda colour code for every pixela drawing list of objects and their properties
File sizegrows with the pixel count: every pixel is storedfor a simple image, small: one entry per object
When enlargedeach pixel is drawn bigger, so blocks show (pixelation)sizes are recalculated, so edges stay sharp
Editingsingle pixels can be changed, e.g. retouchingone object can be changed without touching the rest
Compressionruns of same-coloured pixels shrink well, e.g. with RLEa short drawing list has little repetition to remove
Suitsphotographs: many colours, fine detaillogos, diagrams and plans made of shapes

Justify the choice for the task

Two jobs, two choices: each reason ties a feature of the format to what that job needs.

A cycle club’s badge as a vector graphic

  • It goes on jerseys, flags and a phone app, so it must scale without pixelation.
  • It is a few shapes and letters, so its drawing list is short and the file small.
  • One shape can be changed on its own if the club updates the badge.

A scanned watercolour as a bitmap

  • The painting has many colours and fine brush detail, which pixels record.
  • Single pixels can be retouched, e.g. to remove a speck of dust.
  • As objects it would need an enormous drawing list.
A justification is judged on its reasons: each must back the choice made and fit the task. A badge built around a photograph would be better as a bitmap.
Your turn

1 A school puts the floor plan of its buildings on its website. Visitors zoom in to find rooms. Bitmap or vector? Give a reason.

2 A photographer sells prints of a sunset. Bitmap or vector? Give a reason.

3 Give one difference between a bitmap and a vector graphic as a pair.

  1. 1
    vector: the plan is lines and shapes, so its drawing list is short, and zooming recalculates it without pixelation
  2. 2
    bitmap: a photograph has many colours and fine detail, which pixels record
  3. 3
    for example: a bitmap shows blocks when enlarged, whereas a vector graphic is recalculated and stays sharp
Tick what you can do now
Exam focusMake each difference a pair: “a bitmap shows blocks when enlarged, whereas a vector is recalculated”. For a justification, tie every point to the scenario, and give reasons only for the format you chose.
Practise with s26/11 Q5(c); w21/12 Q5(b)(i) (older paper: paired differences)
12 / 16
9618 · Unit 1 · Information representation
Revisionbyexamplicity

Sound: sampling and encoding

§1.2 · Multimedia · sound

A sound wave rises and falls smoothly, with no gaps: it is analogue. A computer can only keep separate numbers, so it measures the wave at regular intervals and stores each measurement as a binary number.

Each dot is one sample. It is rounded to the nearest of the 16 levels, and that level’s code is written underneath.

Grey: analogue wave000000110110100111001111110010101001101010000011001001101001time → equal sampling intervals4 bits per sample → 16 amplitude levels
Grey: analogue wave000000110110100111001111110010101001101010000011001001101001time → equal sampling intervals4 bits per sample → 16 amplitude levels
1
The wave’s amplitude is measured (sampled) at equal time intervals.
2
Each measurement is rounded to the closest level, and that level’s binary value is written down.
3
The values are kept in sequence, in time order.

Terms

Sampling rate and sampling resolution are easy to swap, and each changes the sound in a different way. Be able to define each term, keeping the words in bold.

TermMeaning
Analogue datacontinuous: the sound wave can take any value at any moment
Digital datadiscrete: a set of separate binary values
Samplingmeasuring the amplitude of the sound wave at regular intervals
Sampling ratehow many samples are taken each second, in hertz: 16 kHz = 16 000 samples a second
Sampling resolutionhow many bits hold each sample: n bits give 2ⁿ amplitude levels
Your turn

1 Which code is stored for the first sample in the figure?

2 Which sample in the figure is stored with the lowest code? Give its code.

3 A sound is sampled at 8 kHz for 2 seconds. How many samples are taken?

4 The sampling resolution is 5 bits. How many amplitude levels are there?

  1. 1
    1100
  2. 2
    sample 7: 0010
  3. 3
    8000 × 2 = 16 000
  4. 4
    2⁵ = 32
Tick what you can do now
Exam focusSample the amplitude, not the frequency. A rate of 16 kHz means 16 000 samples every second, not 16 000 bits.
Practise with s25/13 Q1(b); s26/12 Q4(a); s26/13 Q3(a); s23/13 Q3(c)(i) (older paper: encoding process)
13 / 16
9618 · Unit 1 · Information representation
Revisionbyexamplicity

Sampling rate and resolution

§1.2 · Multimedia · sound

Record the same song twice and one copy can sound crisp and take far more space than the other. Two settings make the difference: the sampling rate is how many samples are taken each second; the sampling resolution is how many bits hold each sample.

Two settings decide how true a recording sounds and how big its file is. The sampling rate is how many samples are taken each second; the sampling resolution is how many bits hold each sample.

Each graph changes one setting from the baseline: count the samples along the time axis, then the levels up the side.

Baseline: 7 samples, 2 bits000110114 levels · same time windowRate only: 16 samples, 2 bits000110114 levels · same time windowResolution only: 7 samples, 3 bits0000010100111001011101118 levels · same time window
Baseline: 7 samples, 2 bits000110114 levels · same time windowRate only: 16 samples, 2 bits000110114 levels · same time windowResolution only: 7 samples, 3 bits0000010100111001011101118 levels · same time window

Effects of changing the settings

Better sound always costs more bits, and the reason says where those bits come from. Be able to link each change to its effect on accuracy and on file size, with the reason.

ChangeAccuracyFile size
increase the sampling ratemore samples per second, so the gaps between them are shorter and the digital wave follows the analogue wave more closelymore samples per second are stored
increase the sampling resolutionmore amplitude levels, so each sample is stored nearer its true amplitude: the quantisation error is smallermore bits are stored for every sample
decrease the sampling resolutionfewer amplitude levels, so a sample may lie further from its true amplitude: quantisation error increasesfewer bits for every sample: smaller file
increase the length of the recordingunchangedmore samples in total

To size a file, multiply the three settings, then weigh what the extra bits cost:

Worked example

44.1 kHz · 16 bits per sample · 30 seconds · uncompressed mono; header excluded
rate × resolution × seconds
44 100 × 16 × 30samples/s × bits × s= 21 168 000 bits÷ 8 = 2 646 000 bytes÷ 1024 ÷ 1024 ≈ 2.52 MiB

Consequences of a larger file

  • More data means it takes longer to send over a network.
  • It uses up storage faster, so a device holds fewer recordings.
  • At the same rate, resolution and duration, stereo doubles the raw size: two channels.

Check the units: a resolution of 2 bytes is 16 bits per sample.

Your turn

1 A mono recording is sampled at 8 kHz with 8 bits per sample for 10 seconds. What is its size in bytes?

2 The sampling resolution goes from 2 bits to 3 bits. How many amplitude levels are there before and after?

3 The recording in question 1 is made in stereo instead. What is its size now?

4 Why does a higher sampling rate make the file larger?

  1. 1
    8000 × 8 × 10 = 640 000 bits ÷ 8 = 80 000 bytes
  2. 2
    2² = 4 levels, then 2³ = 8 levels
  3. 3
    two channels: 160 000 bytes
  4. 4
    more samples are taken each second, and every sample is stored
Tick what you can do now
Exam focusKeep the two settings apart: the rate is samples per second, the resolution is bits per sample. Link each to a mechanism: more samples, or more bits per sample, so a larger file.
Practise with s26/12 Q4(b); w25/13 Q1(a); s24/11 Q2(d); w22/13 Q1(b) (older paper: sound file calculation)
14 / 16
9618 · Unit 1 · Information representation
Revisionbyexamplicity

Compression: lossy and lossless

§1.3 · Compression

Big files are slow to send and soon fill a disk. Compression reduces the size of a file, in one of two ways: keep every detail, or throw some away. The choice depends on whether lost detail would matter, and on how much storage or bandwidth it saves.

Why compress?

A compressed file has fewer bytes, so:

  • it needs less storage;
  • it uses less bandwidth, so it uploads and downloads sooner and a stream buffers less;
  • it uses less of a mobile data allowance;
  • it can fit under a size limit, e.g. for an email attachment.

Lossless

No data is lost: decompressing rebuilds the original exactly.

For text, program files and data where every bit matters, or an image that must keep every detail.

Lossy

Data is permanently removed: the original cannot be rebuilt exactly. The file is usually smaller than with lossless.

For sound, images and video where some loss of detail is not noticed.

What comes back after decompressing

Follow each row of pixels through compress and decompress, then compare what comes back with what went in.

Losslesscompresscompresseddecompressthe original, exactlyLossycompresscompresseddecompressclose, but 2 pixels changed: detail lost
Losslessfiledecompressed: the original, exactlyLossyfiledecompressed: close, but 2 pixels changed: detail lost

Justify a method in context

The same photo may need lossless compression for one job and lossy for another. Be able to choose a method for a scenario and give a reason linked to it.

ScenarioChooseLinked reason
A text file or programlosslessone lost character changes a word or a value, and the file may no longer open: it is corrupted
A live football match sent to phones on mobile datalossyfar fewer bytes each second, so the picture keeps moving on a slow connection
The archive copy of a band’s studio recordinglosslessit will be edited again later, so the original must be rebuilt exactly, every time
Music for a websitelossysmaller files download faster; sound outside human hearing can be removed
An X-ray image for a doctorlosslessevery detail must remain for an accurate diagnosis
  • Decide from the scenario, not the file type.
  • Lossless when every detail must stay and the bandwidth allows it.
  • Lossy when saving storage or bandwidth matters more and the loss goes unnoticed.
  • If an uncompressed video already fits a fast, dedicated connection, compression may not be needed: the bandwidth can carry it without delay.
Your turn

1 A teacher emails a spreadsheet of exam marks. Lossy or lossless? Give a linked reason.

2 A video call runs on a weak phone signal. Lossy or lossless? Give a linked reason.

3 An online shop shows small photos of its products. Lossy or lossless? Give a linked reason.

4 Give two reasons to compress a file before uploading it.

  1. 1
    lossless: one changed digit would give a pupil the wrong mark, so every value must come back exactly
  2. 2
    lossy: far fewer bytes each second, so the call keeps up on the weak signal; small losses go unnoticed
  3. 3
    lossy: smaller photos load faster for shoppers, and the lost detail is not noticed at that size
  4. 4
    any two: it uploads sooner; it uses less bandwidth; it uses less storage; it fits a size limit
Tick what you can do now
Exam focusName the method and link it to the scenario. For text, lossless is needed because all the data must come back: a missing character leaves the text corrupted or meaningless.
Practise with s24/13 Q2(b)(i); s25/11 Q2(b)(i), (b)(ii); s24/12 Q2(d)(iii); w22/12 Q8(c)(ii) (older paper: text must remain exact)
15 / 16
9618 · Unit 1 · Information representation
Revisionbyexamplicity

Compressing text, images and sound

§1.3 · Compression · run-length encoding

A strip of clear sky in a picture can be hundreds of identical blue pixels. Run-length encoding (RLE) is lossless. It finds runs of consecutive equal values and stores each run as one copy of the value and a count.

One row of pixels stored as runs

One row of 16 pixels: W = white, B = black, R = orange5 W3 B2 W6 R16 pixel values are stored as 4 pairs: the number of consecutive pixels and their colour.
16 pixels: W white · B black · R orange5W3B2W6RStore 4 pairs: count + colour code

Text is stored in runs the same way, and runs can also make a file bigger:

Text

AAAAABBBCCCCCCCC (16 characters) → 5A 3B 8C: 6 values.

When RLE makes a file bigger

With no consecutive repeats, RGB becomes 1R 1G 1B: six stored values rather than three, if counts and colour codes use equal space.

Compressing each type of file

What can safely go depends on the file: one lost letter spoils a text file, while a lost tone in music may go unheard. Be able to give a method for each type of file and say whether it is lossy or lossless.

File typeHow it can be compressed
TextLossless: RLE stores a run of one repeated character as a single copy and a count; or common words and letter groups are given shorter codes
Bitmap imageLossless: RLE on runs of same-coloured pixels.
Lossy: lower the resolution or the colour depth, or merge colours that look alike
Vector graphicA short drawing list has little repeated data, so there may be little to compress; stored as markup (SVG) it can be compressed losslessly
SoundLossy: lower the sampling rate; lower the sampling resolution; drop frequencies people cannot hear.
Lossless: use fewer bits per sample for the amplitude range the recording uses, without changing the samples; store each sample’s difference from the last; RLE on repeated samples
Asked for different methods for images and sound? Use image RLE, then a different sound method, such as storing amplitude differences. Repeating RLE does not give a second method.
Your turn

1 Use RLE to encode the row of pixels GGGGRRBBBBBB.

2 Decode the RLE data 3W 2B 1W.

3 A row of 5 pixels has no two neighbours the same colour. How many values does RLE store for it?

4 Give one lossy method and one lossless method for compressing sound.

  1. 1
    4G 2R 6B
  2. 2
    WWWBBW
  3. 3
    10: a count and a colour for each pixel, twice the original 5
  4. 4
    lossy: lower the sampling rate or resolution, or drop frequencies people cannot hear; lossless: store each sample’s difference from the last
Tick what you can do now
Exam focusFor an image, say what a run is: consecutive pixels that share one colour. Each run is kept as that colour’s code plus a count of its pixels. Refer to the image in the question when it gives one.
Practise with s24/13 Q2(b)(ii); s26/12 Q1(d)(ii); s26/13 Q3(c)(i); w24/13 Q6(c)(ii); w25/12 Q6(a); s23/11 Q1(c)(ii) (older paper: when RLE grows)
16 / 16