Past-paper question · 2014 May-June · Paper 22 · Q3(a)(i)

Question 3(a)(i) 2014 · May-June · Paper 22 · 5 marks

Original past-paper question for 3(A)(I)
Original past-paper question for 3(A)(I)
Reveal official mark-scheme answer Official mark-scheme answer for 3(A)(I)

Official answer for Question 3

Part (a)

(i)

Part (a)

(i)

FUNCTION FindArrayIndex(ChildName : STRING) RETURNS INTEGER

✓
i 0
✓
REPEAT
✓
i i + 1
✓
UNTIL Student[i].Name = ChildName
✓
RETURN i
✓
Another method:
✓
FUNCTION FindArrayIndex(ChildName : STRING) RETURNS INTEGER
✓
Found FALSE
✓
i 1
✓
WHILE NOT (Found = TRUE)
✓
IF Student[i].Name = ChildName
✓
THEN Found TRUE
✓
ELSE i i + 1
✓
ENDIF
✓
ENDWHILE
✓
RETURN i
✓
[max 5]

Mark scheme 9691_s14_ms_22.pdf →

Show text version of question

Question 3

Part (a)

(i)

Question 3

After a child uses the program again, the teacher wants the program to find the child’s record in

the array and update the score if it is higher.

(i)

A function, FindArrayIndex, is needed to return the array index of the record in

which the child’s name is stored. Write pseudocode for this function.

Assume:

  • the child’s name exists in the array
  • the children’s names are unique
  • the children’s names are not in any order.

FUNCTION FindArrayIndex(ChildName : STRING)

ENDFUNCTION

[5]
Topic relevance

Why this question appears here

91% assigned-topic match · Programming › Constructs

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 9691_s14_qp_22.pdf

Keep practising this topic