Question 5(c) 2018 · May-June · Paper 22 · 4 marks
Reveal official mark-scheme answer
Official answer for Question 5
Part (c)
Question 4
Question 1
Question 2
Question 3
Question 4
Show text version of question
Question 5
Part (c)
Question 5
A golf club holds information about its members. When a member completes a round of golf, their
score is stored along with their membership number and the date of the round.
is formed into a string as follows:
<MembershipNumber><Date><Score>
Part (c)
The program needs a function, GetNumber(), to return a valid membership number. A valid
membership number is a four-digit numeric string between “1111” and “9999”.
The structured English representing the algorithm for this function is as follows:
1. Prompt and input a membership number. 2. Validate the membership number. 3. Repeat from step 1 if the membership number is invalid. 4. Return the valid membership number as a string.
An example of the function call in pseudocode is:
MembershipNumber GetNumber()
Write program code for the GetNumber() function.
Visual Basic and Pascal: You should include the declaration statements for variables. Python: You should show a comment statement for each variable used with its data type.
Programming language ............................................................................................................
Program code
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
..............................................................................................................................................
Question 12
Why this question appears here
82% assigned-topic match · Programming › Constructs
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9608_s18_qp_22.pdf
