Question 7(c) 2021 · May-June · Paper 23 · 5 marks
Reveal official mark-scheme answer
Official answer for Question 7
Part (c)
Question 5
Show text version of question
Question 7
Part (c)
Question 7
A program is needed to take a string containing a full name and produce a new string of initials.
Some words in the full name will be ignored. For example, "the", "and", "of", "for" and "to" may all be ignored.
Each letter of the abbreviated string must be upper case.
For example:
Full name Initials
Integrated Development Environment IDE
The American Standard Code for Information Interchange ASCII
The programmer has decided to use a global variable FNString of type STRING to store the full name.
It is assumed that:
- words in the full name string are separated by a single space character
- space characters will not occur at the beginning or the end of the full name string
- the full name string contains at least one word.
The programmer has started to define program modules as follows:
Module Description
- Called with an INTEGER as a parameter, representing the number of a
- Returns the character start position of that word in FNString or
- For example: if FNString contains the string "hot and cold",
- Called with a parameter representing the position of the first character
- For example: if FNString contains the string "hot and cold",
word in FNString. GetStart()
returns –1 if that word does not exist
GetStart(3) returns 9
of a word in FNString GetWord() • Returns the word from FNString
GetWord(9) returns "cold"
Question 19
Part (c)
As a reminder, the module description of GetWord() is repeated:
Module Description
- Called with a parameter representing the position of the first
- For example: if FNString contains the string "hot and cold",
character of a word in FNString GetWord() • Returns the word from FNString
GetWord(9) returns "cold"
Write pseudocode for the module GetWord().
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................
Question 22
Question 23
Question 24
reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of the University of Cambridge Local Examinations Syndicate (UCLES), which itself is a department of the University of Cambridge.
Why this question appears here
71% 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 9618_s21_qp_23.pdf
