← VCE Pseudocode

Linear Search algorithm in pseudocode

An algorithm that checks each element in an array one at a time, from the start, until the target is found or the end is reached.

Understanding Linear Search algorithm in pseudocode in VCE Pseudocode

What it does: This line sets found to TRUE once a match is located. DISPLAY prints the value of found to the output. Linear search moves through the array from the first element onward. Linear search works on sorted or unsorted arrays alike. By convention, pseudocode array indexing starts from 1. A single = is used for comparison in pseudocode. Once found, there's no need to keep checking further elements. The ← arrow assigns TRUE to the variable found.

Common mistakes: Array declarations use square brackets, not round brackets. An IF block must close with END IF, not END WHILE.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

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 11–28) and word search (Modules 1–28).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Does linear search check elements one at a time from the start?
YesNo
Matches
IF numbers(i) = target THEN
↓
Wrong - array elements use square brackets, not round
Applying
Meanings
Term
Linear Search
Meaning
An algorithm that checks each element in an array one at a time, from the start, until the target is found or the end is reached.
Practice
BEGIN
Testing
Gaps
i FROM 1 TO 5
Check Answer
Spots
1DECLARE numbers(5) OF INTEGER
2DECLARE target OF INTEGER

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Flamingo' badge — Balanced Coder, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Does linear search check elements one at a time from the start?
A. Yes ✓
B. No
Linear search moves through the array from the first element onward.
2. Does linear search require the array to be sorted first?
A. Yes
B. No ✓
Linear search works on sorted or unsorted arrays alike.
3. Does the FOR loop in linear search typically start at index 1?
A. No
B. Yes ✓
By convention, pseudocode array indexing starts from 1.
4. Is == the correct comparison operator in this pseudocode?
A. No ✓
B. Yes
A single = is used for comparison in pseudocode.
5. Can linear search stop checking once the target is found?
A. Yes ✓
B. No
Once found, there's no need to keep checking further elements.

Match the Pairs

FOR i FROM 1 TO 5 → Loops through each index of the array
IF numbers[i] = target THEN → Checks whether the current element matches the target
Records that a match has been found → found ← TRUE
Outputs a message or value to the user → DISPLAY found
IF numbers(i) = target THEN → Wrong - array elements use square brackets, not round
FOR i FROM 0 TO 5 → Wrong - pseudocode array loops start from 1, not 0

Key Term

Linear Search
An algorithm that checks each element in an array one at a time, from the start, until the target is found or the end is reached.

Fill in the Blanks

1. FOR i FROM 1 TO 5
Hint: Type the loop keyword used to iterate through the array.
2. IF numbers[i] = target THEN
Hint: Type the keyword that starts a selection statement.
3. IF numbers[i] = target THEN
Hint: Type the keyword that follows the IF condition.
4. DISPLAY "Found at position", i
Hint: Type the keyword used to output a message.
5. IF numbers[i] = target THEN
Hint: Type the comparison operator used to check equality.

Spot the Error

Question 1
A DECLARE numbers(5) OF INTEGER
B DECLARE target OF INTEGER
C DECLARE found OF BOOLEAN
Line A — Array declarations use square brackets, not round brackets.
Question 2
A FOR i FROM 1 TO 5
B IF numbers[i] = target THEN
C END WHILE
Line C — An IF block must close with END IF, not END WHILE.
Question 3
A FOR i FROM 0 TO 5
B IF numbers[i] = target THEN
C END IF
Line A — Pseudocode array loops start from 1, not 0, by convention.
Question 4
A FOR i FROM 1 TO 5
B IF numbers[i] == target THEN
C found ← TRUE
D END IF
Line B — Pseudocode comparison uses a single =, not ==.
Question 5
A FOR i FROM 1 TO 5
B IF numbers[i] = target THEN
C found = TRUE
D END IF
Line C — Assignment inside pseudocode uses ←, not =.

Student with a class code? Join your class →