Question 5(c) 2018 · May-June · Paper 23 · 10 marks
Reveal official mark-scheme answer
Official answer for Question 5
Part (c)
Question 1
Question 2
Question 3
Question 4
Question 5
Question 6
Question 7
Question 8
Question 9
Question 10
Question 11
Question 12
Question 13
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.
The information to be stored is as follows:
- MembershipNumber is a four-digit numeric string.
- Date is a six-digit numeric string in the format DDMMYY
- Score is a two-digit numeric string in the range “50” to “99”.
This information is stored in a single string in the format:
<MembershipNumber><Date><Score>
Part (c)
The strings are stored in a text file, ScoreDetails.txt.
The program needs a function, GetAverageScore().
The structured English representing the algorithm for this function is as follows:
1 Receive a membership number as its argument. 2 Search the ScoreDetails.txt file for all scores for that member. 3 Calculate the average score. 4 Return the average score.
You can assume that there will be at least one score relating to each member.
Question 11
Write program code for the GetAverageScore() 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
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................[10]
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_23.pdf
