Question 5(b) 2021 · May-June · Paper 23 · 4 marks
Reveal official mark-scheme answer
Official answer for Question 5
Part (b)
Question 4
Show text version of question
Question 5
Part (b)
Question 5
A program stores a contact list of telephone numbers. Each telephone number is stored as a
string of six or more numeric characters.
Before they are displayed, number strings are formatted to make them easier to read. This involves forming the characters into groups, separated by the space character.
The maximum length of a number group is five characters.
Different numbers may have different groupings. A template string is used to define the grouping.
For example:
Number string Template string Formatted string
For the first row, template "53" results in a formatted string comprising:
- the first five characters in the first group
- a space character
- the next three characters in the second group
- a space character
- the remaining characters from the number string.
Part (b)
The function GroupNum() is to be extended to include parameter checking.
State one check that could be applied to each parameter. Give an example of test data that could be used to demonstrate that each check identifies invalid data.
The type of check must be different for each parameter.
Telephone number check .........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Test data ...................................................................................................................................
Template check .........................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Test data ...................................................................................................................................
Question 15
Question 16
Why this question appears here
71% assigned-topic match · Programming › Structured programming
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_s21_qp_23.pdf
