Fig. 1 shows a flowchart for a parcel-locker program. The program reads a locker number, checks it, and then repeats this process while more customers are w...

Assessment: Computer Science 9210 | Paper 1 Mock 01 | Programming (on-screen) Subject: Computer Science - 9210

Question 1 Report

Fig. 1 shows a flowchart for a parcel-locker program. The program reads a locker number, checks it, and then repeats this process while more customers are waiting. A programmer says the decision in the flowchart should be replaced by a sequence of commands because the program is already inside a loop. The service manager needs the structured program to reject locker numbers outside the range 1 to 48 and to display a useful message.

Enter lockerNo1 ≤ lockerNo ≤ 48?YesOpen lockerNoDisplay errorrepeat for next customer© EAGLE BEACON GLOBAL

(a) Explain the purpose of the decision in Fig. 1. [2]
(b) When lockerNo is 52, state the path the program follows. [2]
(c) Explain why the error message should be displayed before the next loop iteration. [2]

Answer Details

(a) The decision validates the input: it tests whether lockerNo is in the permitted inclusive range 1 to 48. [1] It then selects the appropriate path: open the locker for a valid number, or display an error for an invalid one. [1]

(b) Since 52 is greater than 48, the condition is false, so the program follows the No path. [1] It displays the error message and does not open a locker. [1]

(c) The error must be displayed before the loop restarts so the customer receives feedback that their entry was invalid. [1] They can then enter a corrected locker number on the next iteration. [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