Linear search in pseudocode
Checks each array element in order from the first, comparing it with the target, until a match is found or the end of the array is reached.
Understanding Linear search in pseudocode in IGCSE Computer Science Paper 2
What it does: Setting the flag to TRUE records that the target has been found, so the loop can stop and the result can be reported. A linear search checks each element in order, beginning with the first one. Starting in the middle is a binary search, which needs sorted data. A comparison in a condition uses =. The ← arrow is only for assignment. In a WHILE loop you must add 1 to Index yourself, with Index ← Index + 1. Without it the loop repeats on the same element.
Common mistakes: A linear search starts at the first element and works forwards. FOR Pos ← 5 TO 1 counts down without a STEP, so the loop would not run properly. It should be FOR Pos ← 1 TO 5. Found starts as FALSE, so the condition Found AND ... is false straight away and the loop never runs. To keep searching until a match is found, the condition must use NOT Found.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 242–253) and word search (Modules 232–253).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
linear searchFill in the Blanks
Spot the Error
Student with a class code? Join your class →