References only, not question text. Open Official paper ↗ where Cambridge publishes the paper,
or see the official Cambridge past-papers page; for other papers, ask your
school. “Paper 42” means Paper 4, variant 2.
Practice questions
Original questions written by HomiLabs in the style of the exam, with answers and mark schemes. They are not
Cambridge past paper questions and have not been reviewed by Cambridge. Try each one before opening the answer.
Q1Structure charts & state-transition diagrams · Core · Paper 2 style · 5 marks
(a)State the purpose of a structure chart.[1]
(b)Describe what each of the following shows on a structure chart.(i) An arrow with an empty (hollow) circle at its tail.(ii) An arrow with a filled (solid) circle at its tail.(iii) A small diamond where a module joins the lines to two lower modules.(iv) A curved arrow passing across the lines to some lower modules.[4]
Show answer
(a) To show the modular structure of a program: how the problem is broken down into modules, how modules relate (which module calls which) and what data/parameters pass between them.
B1 shows decomposition into modules and the relationships/parameters between them.
(b) (i) A data couple – a data item (parameter) passed between modules. (ii) A flag – a Boolean/control value passed between modules. (iii) Selection – only one of the lower modules is called, depending on a condition. (iv) Iteration – the lower modules are called repeatedly.
1 mark each.
Q2Structure charts & state-transition diagrams · Core · Paper 2 style · 5 marks
(a)A ticket barrier at a metro station in Lahore has two states: Closed (the start state) and Open. Its behaviour is:• In Closed, tapping a valid card opens the barrier and the green light comes on.• In Closed, tapping an invalid card keeps the barrier closed and the red light comes on.• In Open, when the passenger walks through, the barrier closes.• In Open, if no one walks through within 10 seconds, the barrier closes.Complete a state-transition table with the columns: Current state | Event | Output | Next state.[4]
(b)State how the start state is shown on a state-transition diagram.[1]
Show answer
(a)Closed | valid card tapped | green light | OpenClosed | invalid card tapped | red light | ClosedOpen | passenger walks through | (none) | ClosedOpen | 10 s time-out | (none) | Closed
1 mark for each correct row (current state, event, output and next state all correct).
(b) By an arrow pointing to that state that does not come from any other state (often with a solid dot at its tail).
B1 arrow into the state from no other state.
Q3Structure charts & state-transition diagrams · Standard · Paper 2 style · 6 marks
(a)A structure chart for an online grocery order in Karachi is described as follows.• ProcessOrder is the top module.• ProcessOrder calls GetOrder, which passes OrderID (STRING) and Quantity (INTEGER) up to ProcessOrder.• ProcessOrder calls CheckStock, passing it OrderID and Quantity; CheckStock returns the flag InStock (BOOLEAN).• A diamond on ProcessOrder joins two modules: ConfirmOrder and RejectOrder. Each receives OrderID.Write the pseudocode module headers for GetOrder, CheckStock and ConfirmOrder.[4]
(b)Explain why GetOrder's parameters must be passed by reference.[2]
1 mark: GetOrder as a PROCEDURE. 1 mark: both its parameters BYREF with correct types. 1 mark: CheckStock as FUNCTION with two parameters (by value). 1 mark: RETURNS BOOLEAN and ConfirmOrder as PROCEDURE with OrderID. (Accept CheckStock as a procedure with a BYREF BOOLEAN parameter for the third mark.)
(b) GetOrder must send two values back to ProcessOrder. Passing BYREF passes the address of the caller's variables, so the values assigned inside GetOrder change the caller's variables (a function can return only one value).
1 mark: values must be returned to the calling module. 1 mark: by reference means the original variable is updated / address passed.
Q4Structure charts & state-transition diagrams · Standard · Paper 2 style · 5 marks
(a)A phone-charging locker in a shopping mall in Doha is described by this state-transition table.Current state | Event | Next stateAvailable | door closed and PIN set | LockedLocked | correct PIN entered | OpenLocked | wrong PIN (1st or 2nd attempt) | LockedLocked | wrong PIN (3rd attempt) | BlockedBlocked | staff key used | OpenOpen | door closed | AvailableThe locker starts in Available. State the final state after each sequence of events.(i) door closed and PIN set; wrong PIN; correct PIN; door closed(ii) door closed and PIN set; wrong PIN; wrong PIN; wrong PIN; correct PIN[2]
(b)Explain how the locker leaves the Blocked state and why this design improves security.[2]
(c)Suggest one extra transition that would be useful, giving the current state, event and next state.[1]
Show answer
(a) (i) Available (ii) Blocked
1 mark each. In (ii) the correct PIN has no transition from Blocked, so the locker stays Blocked.
(b) Only a member of staff using the staff key can move it to Open. This stops someone guessing the PIN by trying many values (brute force), because after three wrong attempts entering PINs has no effect.
1 mark: staff key → Open. 1 mark: prevents repeated guessing of the PIN.
(c) e.g. Open | time-out with door left open | Open with alarm/ 'Alarm' state; or Available | staff key used | Open (for cleaning).
B1 any sensible, complete transition.
Q5Structure charts & state-transition diagrams · Standard · Paper 2 style · 6 marks
(a)An alarm system for a shop in Nairobi has states Disarmed (start), Arming, Armed and Alarm. The rules are:• Disarmed: entering the correct code starts a 30-second countdown (Arming).• Arming: when the countdown ends the system becomes Armed; entering the correct code during the countdown returns it to Disarmed.• Armed: if a sensor is triggered, the siren sounds (Alarm); entering the correct code disarms the system.• Alarm: entering the correct code stops the siren and disarms the system.State the number of transitions in the state-transition diagram and list them as 'state –(event)→ state'.[5]
(b)Explain why entering the correct code has a different effect depending on the current state.[1]
1 mark for 6. Then 4 marks for the six transitions: 6 correct = 4, 5 = 3, 4 = 2, 2–3 = 1.
(b) The next state depends on both the event and the current state – the same input causes different transitions from different states.
B1 output/next state depends on current state as well as the event.
Q6Structure charts & state-transition diagrams · Standard · Paper 2 style · 6 marks
(a)The pseudocode below is the main program of a quiz app.CALL ShowRules()FOR Round ← 1 TO 5 CALL AskQuestion(Round, Answer) Correct ← CheckAnswer(Round, Answer) IF Correct = TRUE THEN CALL AddPoint(Score) ENDIFNEXT RoundCALL ShowScore(Score)Describe the structure chart that represents this program. Your description should name the modules, the parameters passed (and their direction) and any symbols for iteration or selection.[6]
Show answer
(a) Top module: Main. Lower modules (left to right): ShowRules (no parameters); AskQuestion – Round passed down, Answer returned up (data couples); CheckAnswer – Round and Answer passed down, Correct returned up as a flag; AddPoint – Score passed down and returned up; ShowScore – Score passed down. A curved iteration arrow covers AskQuestion, CheckAnswer and AddPoint (the loop). A diamond (selection) on the line to AddPoint, because it is only called if Correct is TRUE.
1 mark each for any six of: Main at the top with the five modules beneath; ShowRules with no parameters; AskQuestion with Round down and Answer up; CheckAnswer with Round/Answer down; Correct shown as a flag (solid circle) returned up; AddPoint with Score down and up; ShowScore with Score down; iteration arrow over the three loop modules; selection diamond for AddPoint.
Q7Structure charts & state-transition diagrams · Challenge · Paper 2 style · 6 marks
(a)A structure chart for a weather-station program is described as follows.• Main is the top module.• Main first calls InitialiseTotals, which returns Total (REAL) and Count (INTEGER).• A curved arrow then shows that Main repeatedly calls ReadReading and UpdateTotals.• ReadReading returns Reading (REAL) and the flag EndOfData (BOOLEAN).• UpdateTotals receives Reading and also receives and returns Total and Count.• Finally Main calls OutputAverage, passing Total and Count.The repetition stops when EndOfData is TRUE; the reading returned with EndOfData = TRUE is not a real reading and must not be added.Write pseudocode for module Main, including the declarations of its variables.[6]
1 mark each for: declarations with suitable types for all four variables; CALL InitialiseTotals with Total and Count; a pre-condition loop (or equivalent) controlled by EndOfData; ReadReading called before the loop and at the end of each iteration (so the end marker is not processed); UpdateTotals called inside the loop with Reading, Total, Count; OutputAverage called after the loop with Total and Count.
Q8Structure charts & state-transition diagrams · Challenge · Paper 2 style · 8 marks
(a)A front-loading washing machine has these states: Idle (start), Filling, Washing, Draining, Spinning and Paused. The machine behaves as follows.• Pressing Start in Idle begins filling with water.• When the water level is reached, washing begins.• When the wash timer ends, the water drains.• When the drum is empty, spinning begins; when the spin timer ends, the machine returns to Idle and beeps.• Pressing Pause during Washing moves to Paused; pressing Start in Paused returns to Washing.Write the state-transition table (Current state | Event | Output | Next state) for this machine.[6]
(b)The door must stay locked in every state except Idle. Explain how a state-transition diagram helps the programmer check this requirement.[2]
Show answer
(a)Idle | Start pressed | water valve opens | FillingFilling | water level reached | motor on | WashingWashing | wash timer ends | pump on | DrainingDraining | drum empty | fast spin | SpinningSpinning | spin timer ends | beep | IdleWashing | Pause pressed | motor stops | PausedPaused | Start pressed | motor on | Washing
7 transitions required. 1 mark for each correct transition, max 6 (outputs other than the beep may be any sensible action or left blank).
(b) Every state and every possible transition is shown, so the programmer can check each state/transition to make sure no event leads to the door being unlocked except on entering Idle; missing or unsafe transitions are easy to spot.
1 mark: all states/transitions listed explicitly. 1 mark: can check each one for the door-lock condition / spot missing or unsafe transitions.
Q9Structure charts & state-transition diagrams · Challenge · Paper 2 style · 6 marks
(a)A pedestrian crossing in Abu Dhabi has states CarsGo (start), CarsAmber, WalkGo and WalkFlash.Current state | Event | Output | Next stateCarsGo | button pressed | 'WAIT' lamp on | CarsAmberCarsGo | timer ends | (none) | CarsGoCarsAmber | timer ends | car red, walk green | WalkGoWalkGo | timer ends | walk green flashes | WalkFlashWalkFlash | timer ends | car green, walk red | CarsGoWalkFlash | button pressed | (none) | WalkFlashGive the outputs produced, in order, and the final state, for the event sequence: timer ends, button pressed, button pressed, timer ends, timer ends, button pressed, timer ends.[4]
(b)The table has no entry for 'button pressed' in CarsAmber or WalkGo. Explain what this means for the system.[2]
Show answer
(a) Outputs in order: 'WAIT' lamp on; car red, walk green; walk green flashes; car green, walk red. Final state: CarsGo.
Trace: CarsGo –timer→ CarsGo (no output); –button→ CarsAmber ('WAIT' on); –button→ no transition from CarsAmber, stays CarsAmber; –timer→ WalkGo (car red, walk green); –timer→ WalkFlash (walk flashes); –button→ WalkFlash (no output); –timer→ CarsGo (car green, walk red). 1 mark for each of the first three outputs in the correct order, 1 mark for final output and final state CarsGo.
(b) There is no transition, so pressing the button in those states is ignored: the state does not change and no output is produced (the crossing is already on its way to letting pedestrians cross).
1 mark: event ignored / state unchanged. 1 mark: reason – a crossing request is already in progress.
Q10Testing & maintenance · Core · Paper 2 style · 5 marks
(a)For each situation, identify the type of maintenance: corrective, adaptive or perfective.(i) A tax app crashes when an income of exactly zero is entered, so the code is fixed.(ii) The government changes the sales-tax rate from 17% to 18%, so the program is updated.(iii) The app works correctly but the report is redesigned to load twice as fast.(iv) The app is changed so that it runs on a new version of the phone's operating system.[4]
(b)Explain why maintenance is part of the program development life cycle.[1]
Show answer
(a) (i) Corrective (ii) Adaptive (iii) Perfective (iv) Adaptive
1 mark each.
(b) Programs need to keep working after release – errors are found, requirements and environments change – so maintenance continues for the life of the program.
B1 any valid reason.
Q11Testing & maintenance · Core · Paper 2 style · 5 marks
(a)Describe the difference between black-box testing and white-box testing.[4]
(b)State one reason why both methods are used.[1]
Show answer
(a) Black-box testing: the tester does not look at the code; test data is chosen from the specification and the actual outputs are compared with the expected outputs. White-box testing: the tester knows the code/structure; test data is chosen to test every path/branch through the code, checking that each path works.
Black box: 1 mark – code not seen / based on specification; 1 mark – compare expected and actual outputs. White box: 1 mark – code structure is known; 1 mark – tests every path/branch/statement.
(b) Black-box testing checks the program meets the requirements, while white-box testing finds faults in paths that black-box data might never reach.
B1.
Q12Testing & maintenance · Core · Paper 2 style · 5 marks
(a)Explain what integration testing is.[2]
(b)State three items that a test plan for a program usually contains.[3]
Show answer
(a) Testing modules together after they have been tested individually, to check they work correctly when combined, e.g. that parameters are passed correctly between them.
1 mark: modules combined after unit testing. 1 mark: checks interfaces/data passed between them work.
(b) Any three of: test number; description/purpose of the test; test data; type of test data (normal/abnormal/extreme/boundary); expected result; actual result; comments/action needed.
1 mark each for any three.
Q13Testing & maintenance · Standard · Paper 2 style · 6 marks
(a)A function ValidMark(Mark : INTEGER) RETURNS BOOLEAN returns TRUE if Mark is from 0 to 100 inclusive. Complete a test plan with one test for each type of data below, giving the test value and the expected result.(i) normal (ii) extreme (iii) abnormal (erroneous) (iv) boundary data that should be rejected[4]
(b)Explain why a programmer produces a test plan before testing starts.[2]
Show answer
(a) (i) e.g. 57 → TRUE (ii) 0 or 100 → TRUE (iii) e.g. −20 or 250 → FALSE (iv) −1 or 101 → FALSE
1 mark each for a correct value with its expected result.
(b) So testing is systematic: every requirement and type of data is covered and nothing is forgotten; the expected results are decided in advance so actual results can be compared objectively.
1 mark each for any two valid points.
Q14Testing & maintenance · Standard · Paper 2 style · 6 marks
(a)A software house in Islamabad is writing a stock-control program for a chain of pharmacies. Describe alpha testing, beta testing and acceptance testing in this context.[6]
Show answer
(a) Alpha testing: done in-house by the software house's own testers/programmers before release, with the program still being developed, using realistic test data. Beta testing: an almost finished version is given to a small number of pharmacy staff/selected users, who use it in real conditions and report faults back. Acceptance testing: carried out with the pharmacy chain (client) at the end to show that the program meets every requirement in the agreed specification, so the client agrees to accept it.
For each type: 1 mark for who carries it out, 1 mark for when/purpose.
Q15Testing & maintenance · Standard · Paper 2 style · 6 marks
(a)A programmer is writing the module CalculateDiscount, which calls a function GetLoyaltyPoints(CustomerID : STRING) RETURNS INTEGER. GetLoyaltyPoints has not been written yet. Explain what stub testing is and why it is useful here.[3]
(b)Write pseudocode for a stub of GetLoyaltyPoints.[2]
(c)Name the type of testing carried out when the real GetLoyaltyPoints has been written and is combined with CalculateDiscount.[1]
Show answer
(a) A stub is a simple dummy version of a module that has not been written yet. It has the correct header and returns a fixed (or simple) value, perhaps outputting a message to show it was called. This lets CalculateDiscount be tested now, before GetLoyaltyPoints is finished.
1 mark: stub = dummy/placeholder module. 1 mark: correct interface, returns a fixed value/outputs message. 1 mark: allows the calling module to be tested early.
(b)FUNCTION GetLoyaltyPoints(CustomerID : STRING) RETURNS INTEGER OUTPUT "GetLoyaltyPoints called with ", CustomerID RETURN 250ENDFUNCTION
1 mark: correct header and ENDFUNCTION. 1 mark: returns a fixed integer value (message optional).
(c) Integration testing
B1.
Q16Testing & maintenance · Standard · Paper 2 style · 6 marks
(a)A school-fees program used in several schools in Lahore must be changed because the schools now also accept payment by a mobile-wallet app. Identify the type of maintenance and justify your answer.[2]
(b)Describe two activities the developers should carry out after making the change and before releasing the new version.[4]
Show answer
(a) Adaptive maintenance – the program works correctly but must be changed because the requirements/environment have changed (a new payment method).
1 mark: adaptive. 1 mark: justification – change in requirements, not fixing an error.
(b) Test the new code (and regression-test the existing features to make sure they still work); update the documentation (user guide and technical documentation); train/inform users about the new option; acceptance testing with the schools.
For each of two activities: 1 mark for the activity, 1 mark for the reason/description.
Q17Testing & maintenance · Challenge · Paper 2 style · 7 marks
(a)A bus company uses this function.FUNCTION Fare(Distance : REAL, IsStudent : BOOLEAN) RETURNS REAL DECLARE Cost : REAL IF Distance <= 5 THEN Cost ← 40 ELSE Cost ← 40 + (Distance - 5) * 6 ENDIF IF IsStudent = TRUE THEN Cost ← Cost * 0.5 ENDIF RETURN CostENDFUNCTIONGive the value returned for each call.(i) Fare(3, FALSE) (ii) Fare(5, TRUE) (iii) Fare(12, FALSE) (iv) Fare(12, TRUE)[4]
(b)White-box testing is used. State the minimum number of tests needed so that every IF condition is tested both TRUE and FALSE, and the number needed to test every possible path through the function. Give test data for the minimum set.[3]
(b) Minimum 2 tests, e.g. Fare(3, TRUE) and Fare(12, FALSE). Number of paths = 4.
1 mark: 2 tests. 1 mark: suitable pair where each condition is TRUE in one test and FALSE in the other. 1 mark: 4 paths (2 × 2).
Q18Testing & maintenance · Challenge · Paper 2 style · 8 marks
(a)The function below should return the grade for an exam score (A: 80 or more, B: 65–79, C: 50–64, U: below 50).FUNCTION Grade(Score : INTEGER) RETURNS CHAR IF Score > 80 THEN RETURN 'A' ENDIF IF Score >= 65 THEN RETURN 'B' ENDIF IF Score > 50 THEN RETURN 'C' ENDIF RETURN 'U'ENDFUNCTIONIdentify the two errors by giving test data that would reveal each one, the expected result and the actual result.[4]
(b)Write the corrected lines of code.[2]
(c)State the type of testing data that found these errors and the type of maintenance used to fix them.[2]
Show answer
(a) Score 80: expected 'A', actual 'B'. Score 50: expected 'C', actual 'U'.
For each error: 1 mark for the boundary test value (80, 50), 1 mark for expected vs actual result.
Q19Errors, debugging & IDE use · Core · Paper 2 style · 6 marks
(a)Describe each type of error and give an example of each.(i) syntax error (ii) logic error (iii) run-time error[6]
Show answer
(a) (i) Breaking the grammar rules of the language, so the program cannot be translated – e.g. ENDIF missing, misspelt keyword. (ii) The program runs but gives the wrong result because the algorithm is wrong – e.g. using < instead of <=, wrong formula. (iii) An error that occurs while the program is running and makes it crash or stop – e.g. dividing by zero, array index out of range, opening a file that does not exist.
For each type: 1 mark for the description, 1 mark for a suitable example.
Q20Errors, debugging & IDE use · Core · Paper 2 style · 6 marks
(a)A student's program in an IDE gives a wrong answer. Describe how each of these IDE features could help her find the error.(i) breakpoint (ii) single stepping (iii) variable watch window (report window)[6]
Show answer
(a) (i) A breakpoint pauses execution at a chosen line, so she can check the state of the program at that point. (ii) Single stepping runs the program one statement at a time, so she can see exactly which path is taken and where it goes wrong. (iii) The watch window shows the current values of chosen variables as the program runs, so she can see when a value becomes incorrect.
For each feature: 1 mark for what it does, 1 mark for how it helps find the error.
Q21Errors, debugging & IDE use · Standard · Paper 2 style · 4 marks
(a)This pseudocode should output the average of the 10 marks in the array Marks[1:10].Total ← 0FOR Index ← 1 TO 9 Total ← Total + Marks[Index]NEXT IndexAverage ← Total / 10OUTPUT AverageThe array holds 56, 72, 48, 90, 65, 81, 39, 77, 60, 84 in that order. State the value that is output, and the value that should be output.[2]
(b)Identify the type of error and write the corrected line.[2]
Show answer
(a) Output: 58.8. Should be: 67.2.
B1 58.8 (588 ÷ 10). B1 67.2 (672 ÷ 10).
(b) Logic error; corrected line: FOR Index ← 1 TO 10
1 mark each.
Q22Errors, debugging & IDE use · Standard · Paper 2 style · 5 marks
(a)A program calculates fuel economy for taxi drivers in Lahore using:INPUT DistanceINPUT LitresEconomy ← Distance / LitresOUTPUT EconomyState the type of error that occurs when a driver enters 0 for Litres, and explain why it cannot be found by the translator.[2]
(b)Rewrite the pseudocode so this error cannot happen.[3]
Show answer
(a) Run-time error (division by zero). The code is syntactically correct; the error only happens with certain input values while the program is running.
1 mark: run-time error. 1 mark: syntax is valid / depends on data at run time.
(b)INPUT DistanceREPEAT INPUT Litres IF Litres <= 0 THEN OUTPUT "Litres must be greater than 0" ENDIFUNTIL Litres > 0Economy ← Distance / LitresOUTPUT Economy
1 mark: validation of Litres before the division. 1 mark: loop to re-input (or IF to avoid the calculation). 1 mark: message to the user and correct condition (> 0).
Q23Errors, debugging & IDE use · Challenge · Paper 2 style · 6 marks
(a)This function should return the number of vowels (a, e, i, o, u) in a lower-case word, but it contains three errors.01 FUNCTION CountVowels(Word : STRING) RETURNS INTEGER02 DECLARE Count, Index : INTEGER03 DECLARE Ch : CHAR04 FOR Index ← 1 TO LENGTH(Word)05 Count ← 006 Ch ← MID(Word, Index, 1)07 IF Ch = 'a' OR 'e' OR 'i' OR 'o' OR 'u' THEN08 Count ← Count + 109 ENDIF10 NEXT Index11 OUTPUT Count12 ENDFUNCTIONGive the line number of each error and write the corrected code.[6]
Show answer
(a)Line 05: Count ← 0 must be before the loop (move it to between lines 03 and 04), otherwise Count is reset every time.Line 07: IF Ch = 'a' OR Ch = 'e' OR Ch = 'i' OR Ch = 'o' OR Ch = 'u' THENLine 11: RETURN Count
For each error: 1 mark for identifying the line, 1 mark for the correct correction.
Q24Errors, debugging & IDE use · Challenge · Paper 2 style · 6 marks
(a)This pseudocode should calculate N! (N factorial = 1 × 2 × … × N).01 Result ← 102 Count ← 103 WHILE Count < N04 Result ← Result * Count05 Count ← Count + 106 ENDWHILE07 OUTPUT ResultWith N = 5 the output is wrong. The programmer sets a breakpoint on line 04 and watches Count and Result. Give the values of Count and Result each time the program pauses at the breakpoint (before line 04 runs), and the final output.[4]
(b)Explain what the watched values show and correct the error.[2]
Show answer
(a) Pause 1: Count 1, Result 1. Pause 2: Count 2, Result 1. Pause 3: Count 3, Result 2. Pause 4: Count 4, Result 6. Output: 24.
(b) The loop stops before multiplying by 5 (Count never reaches N inside the loop), so the result is 4! = 24 instead of 120. Correct line 03 to WHILE Count <= N.
1 mark: loop ends one iteration early / last multiplication by N missing. 1 mark: WHILE Count <= N.
Q25Development life cycle · Core · Paper 2 style · 6 marks
(a)State the five stages of the program development life cycle in order.[2]
(b)Describe what happens in the analysis stage.[2]
(c)Give two items produced in the design stage.[2]
2 marks for all five in the correct order; 1 mark for all five in the wrong order or four in the correct order.
(b) The problem is investigated and defined: the current system is studied (e.g. interviews, observation, questionnaires) and a requirements specification is produced that states what the new program must do.
1 mark: investigate/understand the problem. 1 mark: produce requirements specification.
(c) Any two of: structure chart; pseudocode/flowcharts; state-transition diagram; identifier table/data structures; interface (screen) designs; test plan.
1 mark each.
Q26Development life cycle · Core · Paper 2 style · 5 marks
(a)Describe the waterfall model of program development.[3]
(b)Give one benefit and one drawback of the waterfall model.[2]
Show answer
(a) The stages are carried out one after another in a fixed order; each stage must be completed (and signed off) before the next begins; the output of one stage is the input to the next; there is little or no going back to an earlier stage.
1 mark each for any three of the points listed.
(b) Benefit: simple to understand and manage, with clear milestones and documentation. Drawback: the client sees a working program only at the end, so changes to requirements are difficult and expensive to make.
1 mark each.
Q27Development life cycle · Standard · Paper 2 style · 6 marks
(a)Describe the rapid application development (RAD) model.[3]
(b)A start-up in Karachi wants a food-delivery app quickly, but it is not yet sure exactly which features customers want. Explain why RAD is suitable, and give one drawback of using it.[3]
Show answer
(a) Development is done quickly using prototypes; the client gives continual feedback on each prototype, which is improved until it meets their needs; modules may be developed in parallel by small teams, often re-using existing code/tools; little time is spent on detailed planning up front.
1 mark each for any three of the points listed.
(b) Suitable: prototypes can be shown to the client/customers early and changed as the requirements become clear; a working product is produced quickly. Drawback: needs the client to be available for frequent feedback / less focus on non-functional requirements and documentation / not good for very large projects.
1 mark each for two reasons linked to the scenario; 1 mark for a drawback.
Q28Development life cycle · Standard · Paper 2 style · 5 marks
(a)Describe the iterative model of program development.[3]
(b)Explain one difference between the iterative model and the waterfall model.[2]
Show answer
(a) A simple version meeting part of the requirements is developed first; the life-cycle stages are then repeated in cycles (iterations), each adding or improving features; each version is tested and reviewed by the client before the next iteration.
1 mark each for any three of: initial simple version; stages repeated in cycles; features added each time; feedback/review after each iteration; working version available early.
(b) In the iterative model the stages are repeated many times and a working version is available early, whereas in the waterfall model each stage is done once in sequence and the full program is only delivered at the end.
1 mark for each side of the comparison.
Q29Development life cycle · Challenge · Paper 2 style · 6 marks
(a)Recommend a development model for each project and justify your choice.(i) Software that controls the dosage of an infusion pump in a hospital; the requirements are fixed by safety regulations.(ii) A university in Istanbul wants a student timetable app, and expects students to suggest new features after using early versions.(iii) A small charity in Peshawar needs a donation website within six weeks and the director will meet the developers every week.[6]
Show answer
(a) (i) Waterfall – requirements are clear and fixed; each stage must be completed and fully documented and signed off, which suits safety-critical software. (ii) Iterative – a basic version can be released and improved in repeated cycles using student feedback. (iii) RAD – the deadline is short and the client is available for regular feedback on prototypes.
For each project: 1 mark for a suitable model, 1 mark for a justification linked to the scenario (accept other models only with a strong scenario-based justification).
Q30Development life cycle · Challenge · Paper 2 style · 6 marks
(a)During the design stage of a library loans system, the team produces an identifier table, a structure chart, pseudocode and a state-transition diagram for the loan status of a book. Explain the purpose of each of these four design outputs.[4]
(b)Explain why time spent on the design stage can reduce the total cost of the project.[2]
Show answer
(a) Identifier table: lists each variable/constant/array with its data type and purpose, so programmers use them consistently. Structure chart: shows the modules, their hierarchy and the parameters passed between them. Pseudocode: describes the algorithm for each module in a language-independent way, ready to be coded. State-transition diagram: shows the states a book can be in (e.g. Available, OnLoan, Reserved, Overdue) and the events that move it between them.
1 mark for each correct purpose.
(b) Errors and misunderstandings found at design are much cheaper to correct than after coding or release; a clear design also lets several programmers work on separate modules in parallel and makes testing and maintenance easier.
1 mark each for any two valid points.
Similar questions
Questions that test the same subtopic in different years, grouped so you can work on one skill at a time.
References only: find each question in its paper (official link where available, otherwise through your school).