Worked solution from the Programming Paper 2 Algorithms, Programming and Logic booklet, Part 1 of 3.
Match each description to its concept:
| Description | Programming concept |
|---|---|
| a subroutine that may not return a value | procedure |
| a value that is declared and used within a specific procedure | local variable |
| a value that a procedure expects you to supply when it is called | parameter |
| a subroutine that will always return a value | function |
a subroutine that may not return a value → procedure [1]
declared and used within a specific procedure → local variable [1]
a value a procedure expects when called → parameter [1]
a subroutine that will always return a value → function [1]
global variable is not used.
Use the keyword CALL, then the procedure name with the two values in brackets:
CALL Average(25, 50)
Keyword CALL [1]
Procedure name with the correct parameters, Average(25, 50) [1]
Write any three points:
Procedures and functions divide the program into smaller manageable parts, so it is easier to read, understand and debug [1]
They can be re-used in the program or in other programs, and run from a single line [1]
They reduce repeated code, so there is less to change when the program is updated [1]
Also accepted: meaningful names act as documentation (abstraction).
▶ Whole paper
Video solution of the whole paper · by ZAINEMATICS. Tap the picture to open it on YouTube.
Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.