Question 3(b) 2017 · October-November · Paper 23 · 8 marks
Reveal official mark-scheme answer
Official answer for Question 3
Part (b)
Show text version of question
Question 3
Part (b)
Part (b)
The value of UserID should be unique for each user but a problem has occurred and
repeated UserID values may have been issued.
The array is sorted by UserID, so any repeated UserID values will appear in consecutive array elements.
This will:
- compare each element with the previous element and output the UserID and UserName
- output the total number of UserIDs that are repeated.
if the UserID is repeated
For example, the UserNameArray contains the following entries.
Array element Comment
122222Jim Moriarty
123456Fred Smith 123456Eric Sykes Repeated User ID 123456Kevin Turvey Repeated User ID
222244Alice Chan 222244Myra Singh Repeated User ID
333333Yasmin Halim
For this example, the output is:
123456Eric Sykes 123456Kevin Turvey 222244Myra Singh There are 3 repeated UserIDs
If no repeated UserIDs are found, the output is:
The array contains no repeated UserIDs
Question 9
Write program code for the procedure, FindRepeats. You should assume that UserNameArray has been declared as a global variable.
Visual Basic and Pascal: You should include the declaration statements for variables. Python: You should show a comment statement for each variable used with its data type.
Programming language ............................................................................................................
Program code
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[8]
Question 10
Why this question appears here
82% 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 9608_w17_qp_23.pdf
