Single lesson · Written for AQA GCSE Computer Science (8525)

Coding a search – AQA GCSE Computer Science lesson (8525)

Pupils learn to write a search in the class's language on paper for full marks, with meaningful identifiers and correct indentation.

Also in a bundle Compression, Networks and Searching – AQA GCSE Computer Science lessons (8525) 11 lessons for £39 · save 11% on buying separately

Lesson 10 of 11 in unit 10.5 Compression, Networks and Searching, taught in Year 10, Summer 1. It answers one big question: How do we write a search in code for full marks?

By the end, pupils can write a search in the class's language on paper for full marks, with meaningful identifiers and correct indentation.

The Build (the main task)
Write a program that: inputs a member number; uses iteration to carry out a linear search of members, stopping when the number is found; outputs Member if it is found, or Not a member if it is not: Riverbank Libraries keeps its member numbers in the array members. You should use meaningful identifiers and indentation. (7 marks)
Support version
A Parsons problem with one distractor that prints inside the loop.
Challenge
Visits holds the days six members visited. Write a program that inputs a day and outputs how many visits were on that day, using your own linear search. (5 marks) The members array is sorted. Write a program that uses a binary search instead, with start, finish and mid, to output Member or Not a member. Test it with the first item, the last item and a missing item. (7 marks)
Real-world link
Checking whether a visitor is a library member.
Key words
Linear search, Iteration and Readable, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“Comparing a string input with a list of integers works”; “A search loop must check every item even after it finds one”.
AQA 8525 specification
3.1.3 (searching algorithms: linear and binary search); 3.2.2.

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 Compression, Networks and Searching unit bundle, which includes the medium term plan, and in the full-year and complete-course bundles.

Choose your school's Paper 1 language when you buy: C#, Python or VB.NET. You get that language's files: every program, code example, worked answer and programming task is written in it, and lessons with no code are the same in all three. Algorithms are also shown in AQA pseudo-code, as in the exam.

An independent resource written for AQA GCSE Computer Science (8525). It is not endorsed by AQA.

What's included

  • Slide deck (PowerPoint)
  • Lesson plan (Word)
  • Worksheet (Word)
  • Support worksheet with scaffolds (Word)
  • Coding a search - Quiz Quiz Trade Cards
  • Single-teacher licence: use and adapt it with your own classes
  • Your choice of Paper 1 language: C#, Python or VB.NET

More for GCSE Computer Science (AQA)

See all

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