Past-paper question · 2017 May-June · Paper 22 · Q3
Question 3 2017 · May-June · Paper 22 · 0 marks
Reveal official mark-scheme answer
Official answer for Question 3
✓
FUNCTION ExCamel (InString: STRING) RETURNS STRING
✓
DECLARE NextChar : CHAR
✓
DECLARE OutString : STRING
✓
DECLARE n : INTEGER
✓
OutString ← ""
✓
// initialise the return string
✓
// loop through InString to produce OutString
✓
FOR n ← 1 TO LENGTH(InString)
✓
// from first to last
✓
NextChar ← MID(InString, n, 1) // get next character
✓
IF NextChar >= 'A' AND NextChar <= 'Z' // check if upper
✓
case
✓
// NextChar = UCASE(NextChar)
✓
THEN
✓
IF n > 1
✓
// if not first character
✓
THEN
✓
OutString ← OutString & " "
✓
// add space
✓
to OutString
✓
ENDIF
✓
NextChar ← LCASE(NextChar) // make NextChar lower
✓
case
✓
ENDIF
✓
OutString ← OutString & NextChar
✓
// add Nextchar to
✓
OutString
✓
ENDFOR
✓
RETURN OutString
✓
// return value
✓
ENDFUNCTION
Show text version of question
Question 3
READFILE (MyFile, String2)
Topic relevance
Why this question appears here
72% 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_s17_qp_22.pdf
