Question 5(a) 2021 · May-June · Paper 23 · 8 marks
Reveal official mark-scheme answer
Official answer for Question 5
Part (a)
Question 8
Question 1
Question 2
Question 3
Question 4
Question 5
Question 6
Question 7
Show text version of question
Question 5
Part (a)
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 (a)
Write pseudocode for a function GroupNum(), which takes a telephone number and a
template as parameter strings and returns a formatted string.
You may assume that the template and telephone number are valid.
Refer to the Appendix on pages 22 and 23 for the list of built-in pseudocode functions and operators.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Question 13
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................
Question 14
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
