Fig. 1 shows a section of a flow chart used by a community library program. The program lets a borrower scan a membership card, enter a book code and then u...

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

Question 1 Report

Fig. 1 shows a section of a flow chart used by a community library program. The program lets a borrower scan a membership card, enter a book code and then update the loan file. The programmer has decomposed the full task into smaller tasks before writing code in a code editor.

Start loanRead membership codeRead book codeUpdate loan file© EAGLE BEACON GLOBAL

(a) Identify two inputs used by this section of the program. [2]
(b) Give two benefits of decomposing this library task before programming. [2]
(c) Write a suitable name for a subroutine that could contain the task of updating the loan file. [2]

Answer Details

(a) The two inputs are the membership code and the book code. They are the values read into the program before the loan file is updated. [2]

(b) Decomposition breaks a large task into manageable smaller tasks. It allows each task to be tested separately and can allow different programmers to work on separate tasks. It also supports reuse of a task such as file updating. Any two valid benefits gain credit. [2]

(c) A suitable descriptive subroutine name is updateLoanFile. Alternatives such as recordLoan or saveLoan are also valid because the name clearly describes the task. [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