Past-paper question · 2019 May-June · Paper 23 · Q5(a)(ii)

Question 5(a)(ii) 2019 · May-June · Paper 23 · 1 mark

Original past-paper question for 5(A)(II)
Original past-paper question for 5(A)(II)
Reveal official mark-scheme answer Official mark-scheme answer for 5(A)(II)

Official answer for Question 5

Part (a)

(ii)

✓
A trace table

Question 1

Mark scheme 9608_s19_ms_23.pdf →

Show text version of question

Question 5

Part (a)

(ii)

Question 5

Nigel is learning about string handling. He wants to write code to count the number of words in a

given string. A word is defined as a sequence of alphabetic characters that is separated by one or more space characters.

His first attempt at writing an algorithm in pseudocode is as follows:

PROCEDURE CountWords(Message : STRING)

DECLARE NumWords : INTEGER DECLARE Index : INTEGER CONSTANT Space = ' '

NumWords 0

FOR Index 1 TO LENGTH(Message) IF MID(Message, Index, 1) = Space THEN NumWords NumWords + 1 ENDIF ENDFOR

OUTPUT "Number of words : " , NumWords

ENDPROCEDURE

For the built-in functions list, refer to the Appendix on page 18.

His first attempt is incorrect. He will use white-box testing to help him to identify the problem.

(ii)

Dry running the code is often used in white-box testing. In this method, the programmer

records the values of variables as they change.

Identify what the programmer would normally use to record the changes.

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

[1]

Question 13

Topic relevance

Why this question appears here

82% 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_s19_qp_23.pdf

Keep practising this topic