A museum kiosk lets visitors search a file of artefact codes. The code editor uses a count-controlled loop to examine the first five records. Table 1 shows ...

Assessment: Computer Science 4CP0 | Paper 2 Mock 01 | Written Paper 2 Subject: Computer Science - 4CP0

Question 1 Report

A museum kiosk lets visitors search a file of artefact codes. The code editor uses a count-controlled loop to examine the first five records. Table 1 shows the artefact data currently in the program. The variable found starts with the value 0. Each time the program reads the word bronze in the material field, it adds 1 to found. The programmer wants to check that the loop, comparison and total are correct before uploading the program.

Record numberArtefact codeMaterial
1M14bronze
2K08glass
3R31bronze
4A19stone
5B06bronze

(a) Identify the programming construct used to repeat an instruction exactly five times. [2]
(b) Write the assignment statement that increases found by 1. [2]
(c) Use Table 1 to state the final value displayed for found. [2]

Answer Details

(a) A FOR loop [1] is used for this count-controlled iteration [1], because the instruction is repeated exactly five times. [2]

(b) A running total is increased by assigning its old value plus one back to itself:

found = found + 1

[2]

(c) Records 1, 3 and 5 have material bronze. Starting at 0, the total increases three times, so the final value of found is 3. [2]

Download The App On Google Playstore

Everything you need to excel in your exams

Green Bridge CBT Mobile App
Personalized AI Learning Chat Assistant
200,000+ Exam Questions Across IGCSE, JAMB, WAEC & NECO
Over 3,900 Lesson Notes
Offline Support - Learn Anytime, Anywhere
Green Bridge Timetable
Literature Summaries & Potential Questions
Track Your Performance & Progress
In-depth Explanations for Comprehensive Learning