J277 6: Characters, Images and Sound

OCR GCSE COMPUTER SCIENCE · J277 · PAPER 1

Characters, images and sound

How a computer turns letters, pictures and sound into binary, and how big those files get.

Paper 1 · Lesson 6

1 / 24
volgende
Slide 1: Slide
newEditorComputer ScienceUpper Secondary (Key Stage 4)GCSE

In deze les zitten 24 slides, met interactieve quizzen en tekstslides.

time-iconLesduur is: 60 min
Dit is niet oké

Introductie

OCR GCSE Computer Science (J277), Paper 1, lesson 6 of 26. Students learn how characters are stored using character sets (ASCII, extended ASCII and Unicode), how bitmap images are stored using pixels, resolution, colour depth and metadata, and how sound is sampled using sample rate and bit depth. They calculate image and sound file sizes and explain how each factor affects quality and file size, with a do now on binary addition, shifts and hexadecimal, a pixel-grid model, worked examples, a spot-the-mistake and an exam-style question. This lesson was created with AI assistance.

Onderdelen in deze les

OCR GCSE COMPUTER SCIENCE · J277 · PAPER 1

Characters, images and sound

How a computer turns letters, pictures and sound into binary, and how big those files get.

Paper 1 · Lesson 6

Welcome the class. Lesson 6 of the J277 series, Paper 1, section 1.2 (memory and storage: data representation). Today: characters, images and sound, and how to calculate file sizes.

Device-free: show the slide on the board; pupils write the title and date in their books.

Cover photo: Egor Komarov / Unsplash, shown as a hologram.

00 · MISSION · BY THE END OF THIS LESSON

By the end of this lesson you can…

01  Explain how characters are stored using a character set: ASCII and Unicode.

02  Describe how images are stored and calculate an image file size.

03  Describe how sound is sampled and calculate a sound file size.

Read the three outcomes aloud. Point out that outcomes 2 and 3 include calculations: OCR regularly asks for image and sound file sizes on Paper 1, so a calculator is useful today.

Device-free: pupils copy the three outcomes and tick each one at the end of the lesson.

02 · CHECK · DO NOW (LESSON 5)

Warm up: addition, shifts and hex

1  Add 00110101 + 00011011

2  Shift 00010110 two places to the left. What has happened to the value?

3  Convert hex 3C to denary.

4  Convert denary 200 to hex.

▮ TERMINAL // do_now_answers

1  01010000 = 80

   (53 + 27 = 80)

2  01011000 = 88

   (22 × 4: value × 4)

3  3 × 16 + 12 = 60

4  12 × 16 + 8 = C8

Retrieval from lesson 5. Give 4 minutes, then click to reveal each answer line in the terminal.

00110101 (53) + 00011011 (27) = 01010000 (80). Check in binary: carries from the right give 0,0,0,0,1,0,1,0 reading right to left.

00010110 (22) shifted two places left = 01011000 (88). A left shift of two places multiplies by 4 (22 × 4 = 88).

3C: 3 × 16 = 48, C = 12, 48 + 12 = 60.

200 ÷ 16 = 12 remainder 8, so 12 = C and 8 = 8: C8. Check: 12 × 16 + 8 = 200.

Misconception: a left shift of two places multiplies by 4, not by 2. In hex, C is 12, not a variable.

Device-free: questions on the board; pupils answer on mini whiteboards and show on the count of three.

Recap of lesson 5: drag each answer under its question.

1010 1111 in hex

Shift 00000110 left 1

1111 + 0001 in 4 bits

Hex 2C in denary





44

AF

Overflow

00001100

Answers: 1010 1111 = AF; 00000110 shifted left 1 place = 00001100 (6 becomes 12); 1111 + 0001 = 10000, which needs 5 bits, so it is an overflow in 4 bits; hex 2C = 2 x 16 + 12 = 44.

Device-free: students write the four answers in their books, then compare with a partner.

01 · LEARN · MISSION BRIEFING

Everything becomes binary

CHARACTERS

Each letter, digit or symbol has a unique binary code.

IMAGES

A grid of pixels. Each pixel's colour is a binary number.

SOUND

Measured thousands of times a second. Each sample is a binary number.

SYSTEM VOICE

System online. Today's mission: find out how a computer stores text, pictures and sound. Every letter, every pixel and every sample is stored as a binary number.

Click play for the system voice mission briefing. The words are also on the slide: "System online. Today's mission: find out how a computer stores text, pictures and sound. Every letter, every pixel and every sample is stored as a binary number."

Key idea: a computer can only store binary, so text, images and sound all have to be turned into numbers first. Ask: what would a computer need to know to store a photo? (Draw out: how many dots, and what colour each one is.)

Device-free: read the briefing aloud; pupils note one thing they think a computer needs to store for each of the three types.

01 · LEARN · CHARACTER SETS

Every character has a code

A character set is a defined list of characters a computer can use. Each character has its own unique binary code.

The codes run in sequence: if A is 65, then B is 66 and C is 67.

Pressing a key sends that code to the computer.

Define character set: a defined list of characters recognised by the computer, each represented by a unique binary code. Stress that the codes are in sequence, so once one code is known the others can be worked out (A = 65, so D = 68). Lower-case letters have their own codes (a = 97).

Misconception: the character "7" is not stored as the number 7. Its character code is 55.

Device-free: pupils write A to E with their codes, starting from A = 65. Image credit: Christian Lue / Unsplash

01 · LEARN · ASCII AND UNICODE

Two character sets you need to know

ASCII

7 bits per character, so 27 = 128 characters.

Extended ASCII: 8 bits, so 28 = 256 characters.

Enough for English letters, digits and punctuation.

UNICODE

Uses more bits per character, so it can represent far more characters.

Covers the world's languages, symbols and emoji.

Its first 128 codes are the same as ASCII.

▮ TERMINAL // char_codes

1  'A' → 65 → 01000001    'B' → 66 → 01000010

2  'a' → 97 → 01100001    '0' → 48 → 00110000

ASCII uses 7 bits per character: 2 to the power 7 = 128 different characters. Extended ASCII uses 8 bits: 2 to the power 8 = 256 characters, adding accented letters and extra symbols.

Why Unicode exists: ASCII has room only for English characters. Unicode uses more bits per character (exam answers usually say 16 or 32 bits), so it can represent characters from many languages, plus symbols and emoji. The first 128 Unicode codes match ASCII, so ASCII text still works.

Terminal check: 65 = 64 + 1 = 01000001. 66 = 64 + 2 = 01000010. 97 = 64 + 32 + 1 = 01100001. 48 = 32 + 16 = 00110000.

Trade-off for the exam: Unicode can represent more characters, but each character takes more bits, so text files are bigger.

Device-free: pupils write two differences between ASCII and Unicode on mini whiteboards.

In ASCII, 'A' has the code 65. What is the code for 'G'?

A

70

B

71

C

72

D

7

Answer: 71. Codes are in sequence: A 65, B 66, C 67, D 68, E 69, F 70, G 71. G is 6 letters after A, so 65 + 6 = 71.

Common errors: 72 (counting A as one step), 70 (stopping at F), 7 (position of G in the alphabet, not its code).

Device-free: pupils write the answer on mini whiteboards; ask one pupil to count up from A aloud. Image credit: Muneeb Ali Arshad / Unsplash

01 · LEARN · IMAGES

Images are grids of pixels

A bitmap image is made of pixels (picture elements). Each pixel's colour is stored as a binary number.

Resolution: the number of pixels, width × height.

Metadata: data about the image, such as width, height and colour depth, so it displays correctly.

The photo is an extreme close-up of a screen: the tiny dots are pixels. Define pixel (the smallest single point of colour in a bitmap image), resolution (the number of pixels in an image, often given as width × height, for example 1920 × 1080) and metadata (data about the file, such as width, height, colour depth, date taken).

Why metadata matters: without the width, the computer would not know where one row of pixels ends and the next begins.

Misconception: resolution is not the size of the screen in centimetres; it is a count of pixels.

Device-free: pupils write the three definitions in their books. Image credit: Anatoly Maltsev / Unsplash

01 · LEARN · COLOUR DEPTH

Colour depth: bits per pixel

00 · indigo

01 · sky

10 · pink

11 · white

2 bits = 4 colours

Colour depth = the number of bits used to store each pixel's colour.

1 bit → 2 colours
2 bits → 4 colours
8 bits → 256 colours
24 bits → 16,777,216 colours

Colours = 2bits

▮ TERMINAL // pixel_grid

1  row 2 = 10 11 10 10 10

2  whole image = 25 pixels × 2 bits = 50 bits

The 5 × 5 grid is a tiny bitmap with a colour depth of 2 bits, so each pixel can be one of 2 × 2 = 4 colours: 00 indigo, 01 sky, 10 pink, 11 white.

Ask the class to read row 2 from left to right before clicking: pink, white, pink, pink, pink = 10 11 10 10 10. Click to reveal. Then ask for the size of the whole image: 25 pixels × 2 bits = 50 bits. Click to reveal.

Number of colours = 2 to the power of the colour depth: 1 bit 2, 2 bits 4, 8 bits 256, 24 bits 16,777,216 (2 to the power 24; often called true colour).

Key point: more bits per pixel means more possible colours, so the image looks more realistic, but the file is bigger.

Misconception: colour depth is not the number of colours; it is the number of bits. 8-bit colour depth gives 256 colours.

Device-free: draw the grid on the board; pupils write the binary for row 4 (01 10 10 10 01).

01 · LEARN · IMAGE FILE SIZE

Calculating an image file size

File size (bits) = width × height × colour depth

▮ TERMINAL // image_size

1  // 200 × 100 pixels, 24-bit colour

2  pixels = 200 × 100 = 20,000

3  bits   = 20,000 × 24 = 480,000

4  bytes  = 480,000 ÷ 8 = 60,000

5  KB     = 60,000 ÷ 1000 = 60 KB

Bits → bytes: divide by 8.

Bytes → KB: divide by 1000.

More pixels or more bits per pixel: better quality, bigger file.

Worked example, one click per line. Ask the class for each step before revealing it.

200 × 100 = 20,000 pixels. 20,000 × 24 = 480,000 bits. 480,000 ÷ 8 = 60,000 bytes. 60,000 ÷ 1000 = 60 KB. (Checked twice: 200 × 100 × 24 = 480,000; 480,000 ÷ 8 = 60,000.)

OCR uses 1 KB = 1000 bytes, 1 MB = 1000 KB. Metadata adds a little to a real file, but exam calculations ignore it unless the question says otherwise.

Misconception: forgetting to divide by 8. The formula gives bits, not bytes.

Device-free: pupils copy the worked example, then try 100 × 50 pixels at 8-bit colour depth (100 × 50 × 8 = 40,000 bits = 5,000 bytes = 5 KB).

Drag each definition to the key term it describes.

Pixel

Resolution

Colour depth

Metadata





Data about the file, such as its width and height

One single dot of colour in a bitmap image

The number of pixels, width × height

The number of bits stored for each pixel

Answers: Pixel = one single dot of colour in a bitmap image. Resolution = the number of pixels, width × height. Colour depth = the number of bits stored for each pixel. Metadata = data about the file, such as its width and height.

Misconception to listen for: mixing up resolution (how many pixels) with colour depth (how many bits per pixel).

Device-free: read each definition aloud; pupils hold up 1, 2, 3 or 4 fingers for the matching term.

01 · LEARN · SOUND

Sound is sampled

A microphone turns sound into an analogue signal: a smooth, continuous wave.

The computer measures the wave's height (amplitude) at regular intervals. Each measurement is a sample, stored as a binary number.

The samples together make a digital copy of the sound.

Sound in the real world is analogue: it changes smoothly. A computer can only store digital (binary) data, so it takes samples: it measures the amplitude of the wave at regular intervals and stores each measurement as a binary number.

Ask: if the computer only measures every so often, what happens to the sound between measurements? (It is lost, so the digital copy is never perfect.)

Device-free: draw a smooth wave on the board, mark dots on it at regular intervals and explain each dot is a sample. Image credit: Jumping Jax / Unsplash

01 · LEARN · SAMPLE RATE AND BIT DEPTH

More samples, closer to the real sound

LOW SAMPLE RATE · 6 samples

HIGH SAMPLE RATE · 16 samples

SYSTEM VOICE · KEY DEFINITIONS

Sample rate: the number of samples taken each second, measured in hertz (Hz). Bit depth: the number of bits used to store each sample.

Each bar is one sample of the same sound wave. Left: only 6 samples, so the shape of the wave is rough. Right: 16 samples, so the bars follow the wave much more closely.

Click play for the system voice. Words on the slide: "Key definitions. Sample rate: the number of samples taken each second, measured in hertz. Bit depth: the number of bits used to store each sample."

Higher sample rate: more samples per second, closer to the original sound, bigger file. Higher bit depth: more possible values for each sample, so each measurement is more accurate, bigger file. Example: CD quality is 44,100 Hz (44,100 samples every second) with a bit depth of 16.

Misconception: bit depth is not the same as colour depth, but the idea is similar: bits per sample instead of bits per pixel.

Device-free: read the definitions aloud; pupils write them in their books and sketch both panels.

01 · LEARN · SOUND FILE SIZE

Calculating a sound file size

File size (bits) = sample rate × bit depth × duration (seconds)

▮ TERMINAL // sound_size

1  // 10 s clip, 44,100 Hz, 16-bit

2  bits  = 44,100 × 16 × 10

3        = 7,056,000

4  bytes = 7,056,000 ÷ 8 = 882,000

5  KB    = 882,000 ÷ 1000 = 882 KB

44,100 Hz means 44,100 samples every second.

Higher sample rate, higher bit depth or a longer clip: bigger file.

Only rate and depth improve quality.

Worked example, one click per line. Assume one channel (mono); J277 does not ask about stereo.

44,100 × 16 = 705,600 bits per second. × 10 seconds = 7,056,000 bits. ÷ 8 = 882,000 bytes. ÷ 1000 = 882 KB. (Checked twice: 44,100 × 160 = 7,056,000; 7,056,000 ÷ 8 = 882,000.)

Misconception: using minutes instead of seconds. Convert the duration to seconds first (1 minute = 60 seconds).

Device-free: pupils copy the example, then try a 5-second clip at 8,000 Hz with 8-bit depth (8,000 × 8 × 5 = 320,000 bits = 40,000 bytes = 40 KB).

03 · DEBUG · SPOT THE MISTAKE

Amira's answer is wrong. Where?

▮ TERMINAL // amira_working

1  // 400 × 300 pixels, colour depth 4

2  pixels = 400 × 300 = 120,000

3  size   = 120,000 × 4 = 480,000

4  size   = 480,000 bytes = 480 KB

The formula gives one unit. Which one? Tap the marker to check.

Exam tip: write the unit on every line of working: bits, bytes, KB.

Give pupils a minute to find the error before tapping the marker.

Answer: line 4. Lines 2 and 3 are correct: 400 × 300 = 120,000 pixels, × 4 bits = 480,000 bits. Amira forgot that the answer is in bits. 480,000 ÷ 8 = 60,000 bytes = 60 KB. Her answer of 480 KB is 8 times too big. (Checked twice: 400 × 300 × 4 = 480,000; 480,000 ÷ 8 = 60,000.)

Device-free: copy the working onto the board; pupils write the line number and the corrected line on mini whiteboards.

Which change gives a sound recording better quality and a bigger file size?

A

Lower the sample rate

B

Reduce the bit depth

C

Increase the sample rate

D

Make the recording shorter

Answer: increase the sample rate. More samples each second means the digital copy follows the original sound more closely (better quality), and more samples means more bits (bigger file).

Why not the others: lowering the sample rate and reducing the bit depth both make quality worse and the file smaller. A shorter recording makes the file smaller but does not change the quality.

Device-free: pupils hold up A, B, C or D on cards or fingers. Image credit: Jonathan Velasquez / Unsplash

01 · LEARN · QUALITY VS FILE SIZE

Turn it up: what happens?

Resolution ↑

More pixels: sharper detail, bigger file.

Colour depth ↑

More colours: more realistic image, bigger file.

Sample rate ↑

More samples a second: closer to the original sound, bigger file.

Bit depth ↑

More possible values per sample: more accurate sound, bigger file.

Duration ↑  Longer sound: bigger file, but the quality stays the same.

Before each click, ask: "If this goes up, what happens to quality? What happens to file size?" Then reveal.

Pattern to remember: everything that improves quality also increases file size, because more data has to be stored. Duration is the exception: a longer clip is bigger but not better.

Exam phrasing: "Increasing the colour depth increases the number of colours each pixel can be, so the image is more realistic, but more bits are stored for each pixel, so the file size increases."

Device-free: pupils draw a two-column table (quality, file size) and fill in arrows for each factor before the reveal.

1

Each sample is stored as a binary number, using the bit depth

2

The amplitude of the signal is measured at regular intervals: sampling

3

A microphone turns the sound wave into an analogue electrical signal

4

The binary samples are saved one after another in a sound file

How is sound stored on a computer? Put the steps in order.

Correct order: microphone makes an analogue signal; the amplitude is sampled at regular intervals (sample rate = samples per second); each sample becomes a binary number (bit depth = bits per sample); the samples are saved in a file.

Link back: more samples per second or more bits per sample gives better quality and a bigger file.

Device-free: students number the four steps in their books.

Complete the summary.

A character set gives every character a unique binary code. ASCII uses 7 bits per character, while Unicode uses more bits so it can represent many languages. The number of pixels in an image is its resolution, and the number of sound samples taken each second is the sample rate.

character set
ASCII
Unicode
resolution
sample rate
bit depth
metadata
colour depth

Answers in order: character set, ASCII, Unicode, resolution, sample rate. Distractors: bit depth, metadata, colour depth.

Device-free: write the paragraph on the board with gaps and the word bank underneath; pupils write the five missing words.

EXAM · A photo is 2000 × 1000 pixels with a colour depth of 24 bits. Calculate its file size in megabytes (MB). Show your working. [3 marks]

Exam-style question, 3 marks. Give 4 minutes; calculators allowed. The model answer is on the next slide.

Mark scheme: 1 mark: 2000 × 1000 × 24 (or 48,000,000 bits). 1 mark: divide by 8 (6,000,000 bytes). 1 mark: divide by 1,000,000, or by 1000 then 1000 (6 MB). Correct answer of 6 MB with no working: 3 marks. Follow-through allowed after one slip.

Working (checked twice): 2000 × 1000 = 2,000,000 pixels. 2,000,000 × 24 = 48,000,000 bits. 48,000,000 ÷ 8 = 6,000,000 bytes. 6,000,000 ÷ 1000 = 6000 KB. 6000 ÷ 1000 = 6 MB.

Device-free: pupils answer on paper; swap and mark with the mark scheme on the next slide.

04 · EXAM · MODEL ANSWER

Model answer: 6 MB

▮ TERMINAL // photo_size

1  // 2000 × 1000 pixels, 24-bit

2  pixels = 2000 × 1000 = 2,000,000

3  bits   = 2,000,000 × 24 = 48,000,000

4  bytes  = 48,000,000 ÷ 8 = 6,000,000

5  KB     = 6,000,000 ÷ 1000 = 6000

6  MB     = 6000 ÷ 1000 = 6 MB

MARK SCHEME

1 mark: width × height × colour depth

1 mark: ÷ 8 to get bytes

1 mark: ÷ 1,000,000 to get 6 MB

Click to reveal each line. Pupils mark their own or a partner's answer against the mark scheme.

Working (checked twice): 2000 × 1000 = 2,000,000. × 24 = 48,000,000 bits. ÷ 8 = 6,000,000 bytes. ÷ 1000 = 6000 KB. ÷ 1000 = 6 MB.

Common errors: stopping at 48,000,000 (bits, not MB); dividing by 1024 instead of 1000 (about 5.72 MB). The J277 specification uses 1000; check the mark scheme of the paper in use before crediting 1024.

Device-free: read out each line of working; pupils tick each mark they earned.

Exit check: how confident are you calculating file sizes?

1

Very confident: I can do image and sound sizes

2

Fairly confident: I still need the formulas in front of me

3

Not yet: I need another worked example

Anonymous exit poll. Use the results to decide whether to start lesson 7 with another worked example. Lesson 7 (compression) opens with a do now on today's content.

Device-free: pupils show a thumbs up, sideways or down.

05 · NEXT · KEEP GOING

Keep going

Isaac Computer Science

Free online lessons and questions. Look up the data representation topics: characters, images and sound.

BBC Bitesize

GCSE Computer Science, OCR: revise data representation and try the test.

OCR past papers

J277/01 papers and mark schemes on the OCR website. Find the file size questions and check your working.

Next lesson: compression. How do we make these files smaller?

Point pupils to independent practice. Isaac Computer Science (isaaccomputerscience.org) and BBC Bitesize (bbc.co.uk/bitesize) are free. OCR past papers and mark schemes for J277/01 are on the OCR website (ocr.org.uk).

Homework idea: calculate the file size of a 1920 × 1080 image at 24-bit colour depth (1920 × 1080 × 24 = 49,766,400 bits = 6,220,800 bytes = 6,220.8 KB, about 6.2 MB).

Device-free: pupils copy the three sources and the homework question.