Past-paper question · 2024 May-June · Paper 23 · Q4(b)

Question 4(b) 2024 · May-June · Paper 23 · 4 marks

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

Official answer for Question 4

Part (b)

✓
Use of appropriate loop

Question 4

✓
Method to check array maximum not exceeded
✓
Method to check current / next array element not empty
✓
Output of all three array elements per array row (and no more)
✓
Example algorithm:
✓
Count 1
✓
WHILE Count <= 50 AND People[Count, 1] <> "" DO
✓
OUTPUT People[Count, 1]
✓
OUTPUT People[Count, 2]
✓
OUTPUT People[Count, 3]
✓
Count Count + 1
✓
ENDWHILE

Mark scheme 0478_s24_ms_23.pdf →

Show text version of question

Question 4

Part (b)

Question 4

This pseudocode algorithm is intended to allow data for up to 50 people to be entered and stored

in a two-dimensional (2D) array. The data is their last name, first name and the city in which they live.

01 DECLARE People : ARRAY[1:50, 1:3] OF REAL 02 DECLARE Count : INTEGER 03 DECLARE Response : CHAR 04 DECLARE Continue : BOOLEAN 05 FOR I 1 TO 50 06 FOR J 1 TO 3 07 People[I, J] "" 08 NEXT J 09 NEXT I 10 Count 100 11 Continue TRUE 12 CASE OF 13 OUTPUT "Enter the last name" 14 INPUT People[Count, 1] 15 OUTPUT "Enter the first name" 16 INPUT People[Count, 2] 17 OUTPUT "Enter the city" 18 INPUT People[Count, 3] 19 OUTPUT "Do you want to enter another name (Y or N)?" 20 INPUT Response 21 IF Response = 'N' 22 THEN 23 Continue FALSE 24 ELSE 25 Count Count + 1 26 ENDIF 27 UNTIL NOT Count

Part (b)

Write the pseudocode that you could add to the end of this algorithm to output the contents of

the array. Make sure that the output ends when the data in the array ends.

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

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

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

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

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

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

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

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

[4]
Topic relevance

Why this question appears here

98% assigned-topic match · Programming › Arrays

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 0478_s24_qp_23.pdf

Keep practising this topic