Past-paper question · 2012 May-June · Paper 31 · Q3(a)

Question 3(a) 2012 · May-June · Paper 31 · 7 marks

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

Official answer for Question 3

Part (a)

Part (a)

Boolean

[1]
✓
Flags whether or not the requested customer name is found
[1]
✓
SearchName
[1]
✓
Index
[1]
✓
Index + 1
[1]
✓
Index = 2001 // Index >= 2001 // Index > 2000
[1]
✓
IsFound = FALSE // NOT IsFound // Index = 2001 // Index > 2000
[1]

Mark scheme 9691_s12_ms_31.pdf →

Show text version of question

Question 3

Part (a)

Customer names are stored in the array Customer. For An algorithm is to be designed to perform a serial search of the array for a requested Examiner's Use customer name. The algorithm will use the variables shown in the table.

Study the table and the algorithm and fill in the gaps.

Identifier Data Type Description Customer ARRAY[2000] OF STRING The customer names

Index INTEGER Index position in the customer array IsFound

SearchName STRING The requested customer name

//Serial search algorithm INPUT IsFound ← FALSE Index ← 1

REPEAT IF Customer [ ] = SearchName THEN IsFound ← TRUE OUTPUT “FOUND – at position ” Index “ in the array” ELSE Index ← ENDIF UNTIL (IsFound = TRUE) OR

IF THEN OUTPUT “Customer name was NOT FOUND” ENDIF

[7]
Topic relevance

Why this question appears here

72% assigned-topic match · Hardware › Logic gates and logic circuits

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

Keep practising this topic