Past-paper question · 2016 October-November · Paper 22 · Q5(b)(iii)

Question 5(b)(iii) 2016 · October-November · Paper 22 · 4 marks

Original past-paper question for 5(B)(III)
Original past-paper question for 5(B)(III)
Original past-paper question for 5(B)(III)
Original past-paper question for 5(B)(III)
Reveal official mark-scheme answer Official mark-scheme answer for 5(B)(III)

Official answer for Question 5

Part (b)

(iii)

(iii)

‘Pseudocode’ solution included here for development and clarification of mark scheme.

✓
Programming language example solutions appear in the Appendix.
✓
// search for player name ....
✓
Found ← FALSE
✓
i ← 1
✓
REPEAT
✓
IF ThisPlayerName = PlayerName[i]
✓
THEN
✓
Found ← TRUE
✓
PlayerNumber ← i
✓
ELSE
✓
i ← i + 1
✓
ENDIF
✓
UNTIL (Found = TRUE) OR (i = 9)
✓
One mark for each of:
  • Initialise i to 1 and Found to FALSE
  • Loop through array PlayerName (including exit when found)
✓
•
✓
Comparison: ThisPlayerName = PlayerName[i] in a loop
  • Found set to TRUE if ThisPlayerName found
✓
[Max. 4]

Mark scheme 9608_w16_ms_22.pdf →

Show text version of question

Question 5

Part (b)

(iii)

Question 5

A team keeps a record of the scores made by each of their eight players in a number of games.

The data in the two tables below shows:

  • the scores of the eight players after twenty games
  • the eight player names.

1 2 3 8 1 12 17 67 31

2 35 82 44 29

3 61 39 80 17

4 81 103 21 11

5 56 0 98 4

…

19 45 6 81 77

20 12 11 3 6

1 Vorma

2 Ravi

3 Chada

4 Nigam

5 Bahri

6 Smith

7 Goyal

8 Lata

The team wants a computer program to input and record the player data. The player names are permanently stored in a text file NAMES.TXT, with one name on each line. The player names will be read by the program and stored in a 1D array.

The design given in part

Part (a)

will be expanded so that the user is prompted for the player

name instead of the player number. Step 02 now becomes:

02.1 Read the player names from file NAMES.TXT into the array PlayerName 02.2 INPUT ThisPlayerName 02.3 Search the PlayerName array for ThisPlayerName to find the PlayerNumber

(iii)

Program code is to be designed and written for step 02.3

The program will use these identifiers:

Identifier Data type Description PlayerName ARRAY[1 : 8] OF STRING Stores the player names (read from the file) ThisPlayerName STRING Input by the user (step 02.2) Flags when ThisPlayerName is found Found BOOLEAN when searching the PlayerName array i INTEGER Array index

Write program code to carry out the linear search for step 02.3

There is no requirement to declare or comment on variables used.

Programming language .....................................................................................................

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

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

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

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

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

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

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

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

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

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

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

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

[4]

Question 15

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