Question 6(b)(ii) 2015 · October-November · Paper 21 · 1 mark
Reveal official mark-scheme answer
Official answer for Question 6
Part (b)
(ii)
(ii)
27 // 28
Show text version of question
Question 6
Part (b)
(ii)
Question 6
A firm employs five staff who take part in a training programme. Each member of staff must
complete a set of twelve tasks which can be taken in any order. When a member of staff successfully completes a task, this is recorded.
To test the code, the programmer makes the program generate test data.
The program generates pairs of random numbers:
- the first, in the range, 1 to 5 to represent the member of staff
- the second, in the range, 1 to 12 to represent the task
Each pair of numbers simulates the completion of one task by one member of staff. Data is currently recorded manually as shown.
Staff Task number number 1 2 3 4 5 6 7 8 9 10 11 12
Question 1
Question 2
Question 3
Question 4
Question 5
The table shows that two members of staff have each successfully completed one task.
The program must use a suitable data structure to store, for all staff:
- tasks successfully completed
- tasks not yet successfully completed
The program will output the staff number and task number in the order in which tasks are completed.
Question 10
The program design in pseudocode is produced as follows:
01 DECLARE StaffNum : INTEGER 02 DECLARE TaskNum : INTEGER 03 DECLARE ..................................................................................................................................... 04 DECLARE NewStaffTask : BOOLEAN 05 06 CALL InitialiseTaskGrid 07 Completed ← 0 08 WHILE Completed <> 60 09 NewStaffTask ← FALSE 10 WHILE NewStaffTask = FALSE 11 StaffNum ← RANDOM(1,5) //generates a random number 12 TaskNum ← RANDOM(1,12) //in the given range 13 IF TaskGrid[StaffNum, TaskNum] = FALSE 14 THEN 15 TaskGrid[StaffNum, TaskNum] ← TRUE 16 NewStaffTask ← TRUE 17 OUTPUT StaffNum, TaskNum 18 ENDIF 19 ENDWHILE 20 Completed ← Completed + 1 21 ENDWHILE 22 OUTPUT "Staff Task Count", Completed
Question 23
24 // end of main program
Question 25
26 PROCEDURE InitialiseTaskGrid() 27 DECLARE i : INTEGER 28 DECLARE j : INTEGER 29 FOR i ← 1 TO 5 30 FOR j ← 1 TO 12 31 TaskGrid[i, j] ← FALSE 32 ENDFOR 33 ENDFOR 34 ENDPROCEDURE
Question 11
Study the pseudocode and answer the questions below.
Give the line number for:
(ii)
The declaration of a local variable. ....................
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_w15_qp_21.pdf
