Past-paper question · 2019 October-November · Paper 23 · Q5

Question 5 2019 · October-November · Paper 23 · 8 marks

Original past-paper question for 5
Original past-paper question for 5
Original past-paper question for 5
Reveal official mark-scheme answer Official mark-scheme answer for 5

Official answer for Question 5

✓
FUNCTION Abbreviate(Name : STRING) RETURNS STRING

Question 8

✓
DECLARE NewString : STRING
✓
DECLARE NextChar : CHAR
✓
DECLARE Index : INTEGER
✓
DECLARE Space : BOOLEAN
✓
CONSTANT SPACECHAR = ' '
✓
Space ← TRUE
✓
NewString ← ""
✓
FOR Index ← 1 TO LENGTH(Name)
✓
NextChar ← MID(Name,Index,1)
✓
IF Space = TRUE
✓
THEN
✓
NewString ← NewString & NextChar // first char
✓
of next word
✓
Space ← FALSE
✓
ELSE
✓
IF NextChar = SPACECHAR
✓
THEN
✓
Space ← TRUE
✓
ENDIF
✓
ENDIF
✓
ENDFOR
✓
RETURN NewString
✓
ENDFUNCTION

Mark scheme 9608_w19_ms_23.pdf →

Show text version of question

Question 5

Abbreviations are often used in place of a full name. Concatenating the first letter of each word in the name makes an abbreviation.

For example:

Name Abbreviation

United Nations UN

World Wide Web WWW

British Computer Society BCS

A
function, Abbreviate(), will take a string representing the full name and return a string

containing the abbreviated form.

You should assume that:

  • names only contain alphabetic characters and space characters
  • names always start with an alphabetic character
  • each word in the name always starts with an uppercase character
  • only a single space separates words in the name.

Question 11

Write pseudocode to implement the function Abbreviate().

Refer to the Appendix on page 16 for the list of built-in functions and operators.

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

....................................................................................................................................................

[8]

Question 12

Topic relevance

Why this question appears here

99% assigned-topic match · Data types and structures › Data types and records

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_w19_qp_23.pdf

Keep practising this topic