Question 1
1 markA library program contains the four pseudo-code statements below.
Which one of the statements calls a subroutine?
Choose your answer.
- SUBROUTINE lateFee(days)
- RETURN days * 20
- fee ← lateFee(days)
- total ← total + fee
Model answer
fee ← lateFee(days)
Explanation
A subroutine is called by writing its name with any parameters in a statement, and fee ← lateFee(days) calls lateFee and stores the value it returns. SUBROUTINE lateFee(days) defines the subroutine but does not run it, and RETURN days * 20 is inside the subroutine. The last statement is an ordinary assignment.
Mark scheme
-
1 mark
fee ← lateFee(days)
If more than one option is given, 0 marks. Mark is for AO2 (apply).