Past-paper question · 2017 October-November · Paper 23 · Q3(a)

Question 3(a) 2017 · October-November · Paper 23 · 8 marks

Original past-paper question for 3(A)
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)

✓
PROCEDURE
✓
BubbleSort

Question 8

✓
DECLARE
✓
Temp : STRING
✓
DECLARE
✓
FirstID, SecondID : INTEGER
✓
DECLARE
✓
NoSwaps : BOOLEAN
✓
DECLARE
✓
Boundary : INTEGER
✓
Declare
✓
J : INTEGER
✓
Boundary ← 99
✓
REPEAT
✓
NoSwaps ← TRUE
✓
FOR J ← 1 TO Boundary
✓
FirstID ← UserNameArray[J]
✓
SecondID ← UserNameArray[J + 1]
✓
IF FirstID > SecondID
✓
THEN
✓
Temp ← UserNameArray[J]
✓
UserNameArray[J] ← UserNameArray[J + 1]
✓
UserNameArray[J + 1] ← Temp
✓
NoSwaps ← FALSE
✓
ENDIF
✓
ENDFOR
✓
Boundary ← Boundary - 1
✓
UNTIL NoSwaps = TRUE
✓
ENDPROCEDURE
✓
Mark as follows:
✓
1. Procedure heading and ending (allow array as input parameter)
✓
2.
✓
Variable declaration for counter / index (integer) or temp (string)
✓
3.
✓
Outer working loop
✓
4.
✓
Inner loop with suitable range
✓
5.
✓
Correct comparison in a loop
✓
6.
✓
Correct swap of complete array element in a loop
✓
7.
✓
Set flag to indicate swap in inner loop and resetting in outer loop
✓
8.
✓
Reducing Boundary in a loop
✓
9608/23
✓
Cambridge International AS/A Level – Mark Scheme
✓
October/November
✓
PUBLISHED
✓
2017
✓
Question
✓
Answer
✓
Marks

Mark scheme 9608_w17_ms_23.pdf →

Show text version of question

Question 3

Part (a)

A
multi-user computer system stores information about users. It uses a 1D array,

UserNameArray, of type STRING. There are 100 elements in the array.

The format of the string in each element of the array is as follows:

<UserID><UserName>

  • UserID is a six-character string of numerals.
  • UserName is a variable-length string.

Write pseudocode for a procedure, BubbleSort, to perform an efficient bubble sort on UserNameArray. The array is to be sorted in ascending order of UserID.

You should assume that UserNameArray has been declared as a global variable.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Question 7

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

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

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

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

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

...............................................................................................................................................[8]

Question 8

Topic relevance

Why this question appears here

72% 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_w17_qp_23.pdf

Keep practising this topic