Single lesson · Written for OCR J277

1D arrays – OCR GCSE Computer Science lesson (J277)

Pupils learn to declare a 1D array, read and change its elements by index, and use a FOR loop to process every element.

Also in a bundle Characters, Images, Sound, Strings and Arrays – OCR GCSE Computer Science lessons (J277) 11 lessons for £39 · save 11% on buying separately

Lesson 5 of 11 in unit 10.4 Characters, Images, Sound, Strings and Arrays, taught in Year 10, Spring 2. It answers one big question: How can one variable hold a whole list of values?

By the end, pupils can declare a 1D array, read and change its elements by index, and use a FOR loop to process every element.

The Build (the main task)
Write a program that stores the day's sales for five food stalls in an array: 120, 85, 40, 210 and 95. Use a FOR loop to print each stall's position and sales and to add up the total, then print the total. Finally, let the user enter a stall's position and its new sales, change that array element, and print the array.
Support version
Part-filled code: the array, the loop and the total line are given with gaps for the index, the loop's range and the update line.
Challenge
Extend the program to find and print the stall with the highest sales using a loop, without max().
Real-world link
The app stores the day's ticket sales for each food stall in one array.
Key words
Array, Array element and Position, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“The first element of an array is stalls[1]”; “stalls[2] = 90 adds a new element to the array”.
OCR J277 specification
2.2.3 (additional programming techniques: string manipulation (length, case, substrings, concatenation, ASCII conversion) and 1D and 2D arrays).

Every lesson follows the same Code & Commerce structure: a Bell Task recall starter, key vocabulary with definitions and icons, short teaching chunks with a check before pupils move on, The Build (one main task), challenge questions that get harder, and an exit question. Answers reveal one at a time on the slides, and everything is editable PowerPoint and Word.

Pupils need computers for the main task.

Also sold in the Characters, Images, Sound, Strings and Arrays unit bundle, which includes the medium term plan, and in the full-year and complete-course bundles.

What's included

  • Slide deck (PowerPoint)
  • Lesson plan (Word)
  • Worksheet (Word)
  • Support worksheet with scaffolds (Word)
  • Single-teacher licence: use and adapt it with your own classes

More for GCSE Computer Science (OCR)

See all

Written for the specifications named. Not endorsed by or affiliated with any exam board.