A technician prepared a program to control lockers at a railway station. A passenger enters a locker number and a PIN. The program must check the PIN, open ...

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

Question 1 Report

A technician prepared a program to control lockers at a railway station. A passenger enters a locker number and a PIN. The program must check the PIN, open the correct locker and write an event to a security file. Before programming, the technician decomposes the system so that each task can be tested using test data.

(a) Identify the two inputs required when a passenger unlocks a locker. [2]
(b) Write three suitable subroutine names for the main program. One must check the PIN, one must open a locker and one must write to the event file. [3]
(c) Give two details that should be retained in an abstract model of a locker for the unlocking algorithm. [2]
(d) State two physical details of a locker that are not required by that algorithm. [2]
(e) Use the variable pinCorrect to write a condition that allows the locker to open only when the PIN is correct. [1]

Answer Details

(a) The required inputs are the locker number and the PIN. The number identifies the locker, while the PIN is checked for access. [2]

(b) Suitable subroutine names are checkPIN, openLocker and writeEvent. logEvent is also valid for writing the security-file record. [3]

(c) An abstract locker model should retain the locker number and the stored PIN or encrypted PIN data. Locked/unlocked status and availability status are also relevant. [2]

(d) The paint colour and door material are not needed by an algorithm that checks a PIN and unlocks a numbered locker. [2]

(e) The required condition is:

pinCorrect

Equivalently, pinCorrect = TRUE. The locker opens only when this Boolean condition is true. [1]

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