The canteen ordering program stores each order in a queue before it is sent to the kitchen. During a busy lunch break, a network connection fails after the ...

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

Question 1 Report

The canteen ordering program stores each order in a queue before it is sent to the kitchen. During a busy lunch break, a network connection fails after the customer has paid but before the displayed confirmation appears. The customer presses the Pay button again. The programmer must make the program robust so that it does not create duplicate orders or lose a paid order. A transaction log is available, and each payment provider message includes a unique payment reference.

(a) Explain why the payment reference should be checked before a new order is added. [2]
(b) When the network fails, describe one message that should be displayed to the customer. [1]
(c) Explain one use of a transaction log during recovery. [2]
(d) When the program receives the same payment reference twice, state what it should do. [1]

Answer Details

(a) Check whether the unique payment reference has already been processed before adding an order. This prevents a second request from creating a duplicate order or causing a duplicate charge. [2]

(b) A suitable message is: Payment is being checked. Do not submit again. [1]

(c) A transaction log records the stage or status of each order. During recovery, the program can use it to identify a paid order that was not completed and recover it rather than losing it or creating it twice. [2]

(d) If the same payment reference arrives twice, do not create another order. Ignore or flag the duplicate request. [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