Past-paper question · 2016 October-November · Paper 22 · Q2(a)(iii)

Question 2(a)(iii) 2016 · October-November · Paper 22 · 1 mark

Original past-paper question for 2(A)(III)
Original past-paper question for 2(A)(III)
Original past-paper question for 2(A)(III)
Reveal official mark-scheme answer Official mark-scheme answer for 2(A)(III)

Official answer for Question 2

Part (a)

(iii)

(iii)

213

[1]

Mark scheme 9608_w16_ms_22.pdf →

Show text version of question

Question 2

Part (a)

(iii)

Question 2

You will need to refer to the list of pseudocode string-handling functions in the Appendix.

Give the value of the variables x, y and z for the following sequence of statements.

(iii)

Temp1 "13"

Temp2 ONECHAR("One-2-One", 5) z TONUM(Temp2 & Temp1) z ............................

[1]
A
computer program is to simulate the reading and processing of a string of characters from an

input device.

The character string consists of:

  • a number of digit characters
  • one or more <*> characters, each used as a separator
  • a final <#> character.
A
typical input character sequence, stored as InputString is:

Question 6

Study this pseudocode.

01 DECLARE Numbers ARRAY [1:100] OF INTEGER 02 DECLARE InputString : STRING 03 DECLARE NextChar : CHAR 04 DECLARE NextNumberString : STRING 05 DECLARE i : INTEGER // Numbers array index 06 DECLARE j : INTEGER // InputString index 07 08 OUTPUT "String ... " 09 INPUT InputString 10 j 1 11 NextChar ONECHAR(InputString, j)

Question 12

13 i 1 14 WHILE NextChar <> '#' 15 NextNumberString = "" 16 WHILE NextChar <> '*' 17 NextNumberString NextNumberString & NextChar 18 j j + 1 19 NextChar ONECHAR(InputString, j) 20 ENDWHILE

Question 21

22 // store the next integer to the array 23 Numbers[i] TONUM(NextNumberString) 24 i i + 1 25 j j + 1 26 NextChar ONECHAR(InputString, j) 27 ENDWHILE

Question 28

29 CALL DisplayArray()

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

Keep practising this topic