BIRLA OPEN MINDS INTERNATIONAL SCHOOL, KOLLUR
Cambridge International Education
Algorithm Revision Worksheet (2025-2026)
Subject: Computing Grade: 8 Section: A, B
Topic: Algorithm Date:
1. A student wrote the following pseudocode to calculate the average of three test scores:
OUTPUT "Enter three test scores"
INPUT score1, score2, score4
total ← score1 + score2 + score3
averge ← total % 3
OUTPUT "Average = ", average
Identify the errors in the pseudocode.
2. The school canteen wants a small algorithm to calculate the bill for snacks.
a. Predict:
OUTPUT "Enter price of one snack"
INPUT price
OUTPUT "Enter number of snacks"
INPUT quantity
total ← price * quantity
OUTPUT "Total to pay = ", total
• If price = 15 and quantity = 4, what will be displayed?
• If price = 20 and quantity = 0, what is the output?
b. Investigate:
• Which line calculates the total?
• Which lines are inputs and which are outputs?
• What would happen if the line total ← price * quantity was moved before reading price
and quantity?
c. Modify:
Update the pseudocode so that the program adds 5 to the total before outputting.
BOMIS/CIE/ Algorithm Revision WS/G8/Computing/2025-26 Page 1 of 7
d. Make a new pseudocode algorithm,
• Scenario: “Print Shop” charges costPerPage for colour printouts.
• Identify inputs.
• Output total print cost.
e. Test plan:
Complete the test plan to test part (d) with the different test types.
Test data type Description Inputs Expected output
3. A cinema program calculates ticket prices.
Pseudocode rules:
• Standard price = 200
• Students get 50 rupees discount → pay 150
• Seniors (age ≥ 60) pay 100
Assume this pseudocode:
OUTPUT "Enter age"
INPUT age
OUTPUT "Are you a student? (yes/no)"
INPUT student
IF age >= 60
THEN
price ← 100
ELSEIF student = "yes"
THEN
price ← 150
ELSE
price ← 200
ENDIF
OUTPUT "Ticket price = ", price
a. Predict:
• age = 65, student = "no"
• age = 20, student = "yes"
• age = 15, student = "no"
BOMIS/CIE/ Algorithm Revision WS/G8/Computing/2025-26 Page 2 of 7
b. Investigate:
• Why should the senior condition be checked first?
• What happens if you swap the order of the IF and ELSEIF?
• Which tests are normal, which are boundary (e.g., age 60), and which could be erroneous
(e.g., age = -5)?
c. Modify:
Add a new rule: children under 5 are free (price = 0).
4. A fitness band records the number of steps taken every hour during the day.
Pseudocode:
totalSteps ← 0
FOR hour ← 1 TO 24
INPUT steps
totalSteps ← totalSteps + steps
NEXT hour
OUTPUT totalSteps
a. Predict:
• Predict the number of times the loop body will run.
• If every steps value was 1000, predict the output.
b. Investigate:
• Explain why this is a count‑controlled loop.
• State one change needed to adapt this algorithm to work with only 10 hours of data.
c. Modify the algorithm so that:
• It also counts how many hours had more than 2000 steps.
• It outputs both totalSteps and the count of “active” hours.
5. A store’s inventory system keeps sorted product IDs in ascending order. The system uses binary
search. [101, 123, 145, 167, 189, 201, 223, 245]
BOMIS/CIE/ Algorithm Revision WS/G8/Computing/2025-26 Page 3 of 7
a. Predict the sequence of mid values when targetID = 189.
b. Investigate:
• State one condition that must be true about productid for binary search to work
correctly.
• State one advantage of binary search over linear search for very large inventories.
c. Modify the algorithm so that instead of just setting found ← TRUE, it also stores the position
of the found item in a variable pos, and outputs pos at the end.
6. For sports day, a PE teacher records the times (in seconds) of 4 runners in a race and wants to
know:
• the fastest time
• whether any runner finished in less than 15 seconds
Write pseudocode that,
• inputs 4 times,
• finds the smallest time and stores it in a variable,
• checks if any time is less than 15 seconds,
• outputs the fastest time,
• outputs "Record broken" if any runner finished in less than 15 seconds, otherwise "No
record this time".
• complete the test plan with the suitable test data (set of four times each) that would help
check your algorithm works correctly for both messages.
Test data type Description Inputs Expected output
7. The flowchart below represents a program routine.
The array used in the flowchart contains the following data:
BOMIS/CIE/ Algorithm Revision WS/G8/Computing/2025-26 Page 4 of 7
Complete the trace table using the data given in the array.
BOMIS/CIE/ Algorithm Revision WS/G8/Computing/2025-26 Page 5 of 7
8. This flowchart checks a batch of 10 rice sacks for weight. Sacks should weigh 50 kilograms each.
Sacks weighing over 50.5 kilograms or less than 49.5 kilograms are rejected. The number of sacks
accepted and the number of sacks rejected is output.
Complete the trace table for the input data:
50.4, 50.3, 49.1, 50.3, 50.0, 49.5, 50.2, 50.3, 50.5, 50.6
BOMIS/CIE/ Algorithm Revision WS/G8/Computing/2025-26 Page 6 of 7
BOMIS/CIE/ Algorithm Revision WS/G8/Computing/2025-26 Page 7 of 7