Computer Science Paper 2 Final Revision Questions - 2017
Computer Science Paper 2 Final Revision Questions - 2017
EmployeeID, an employee ID which must be two letters followed by 4 numbers, e.g. TY4587
Manager, whether the employee is a manager or not
AnnualHoliday, number of whole days annual holiday
PayGrade, the employees pay grade which must be a single letter AF
EmployeeID
Manager
AnnualHoliday
PayGrade
[8]
2 (a) Rewrite the following pseudocode algorithm using a WHILE DO ENDWHILE loop.
INPUT Num
FOR Counter 1 TO 12
Num Num * Counter
A[Counter] Num
NEXT
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[4]
(b) Explain the differences between a WHILE DO ENDWHILE and a REPEAT UNTIL
loop.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[4]
3 (a) Write an algorithm, using pseudocode and a FOR TO NEXT loop structure, to input
1000 numbers into an array.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[3]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[4]
(c) Write an algorithm, using pseudocode and a FOR TO NEXT loop structure, to output
1000 Names of student from an array.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[3]
4(a) A programmer writes a program to store a patients temperature every hour for a day.
State the data structure that would be most suitable to use and give the reason for your choice.
Reason ..............................................................................................................................................
......................................................................................................................................................[2]
[4]
(c) Describe, with examples, two sets of test data you would use to test your algorithm.
[2]
Use the pre-release material and your experience from attempting the tasks before the examination to
answer Question 1.
1(a) Write an algorithm to complete Task 3, using either pseudocode, programming statements
assuming Task 2 is completed.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
..................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[5]
(b) Give three different data sets that could be used to check your validation rules for Task 1.
Explain why you chose each data set.
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[6]
(b) (ii) Describe suitable validation rules for Task 1.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
[8]
2 Identify two different selection statements that you can use when writing pseudocode.
1 ........................................................................................................................................................
..........................................................................................................................................................
2 ........................................................................................................................................................
......................................................................................................................................................[2]
10
6 A database table, DEVICE, has been set up to record the electronic equipment used in a small
business.
Sort: Ascending
Show: 3
Criteria: Y >1000
or:
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[2]
(b) Complete the query-by-example grid below to select all Desktop devices that were either
purchased before 31/12/2016 or cost under $1000. Only show the Device ID and Device
Type.
Field:
Table:
Sort:
Show:
Criteria:
or:
[4]
Answers
3 1 mark for each correctly completed element of the grid 8
Example:
INPUT Num
Counter 1
WHILE Counter <= 12 DO
Num Num * Counter
A [Counter] Num
Counter Counter + 1
ENDWHILE
Correct data
Correct order
(b) 4 marks
initialisation
start of loop
update loop counter
end of loop
Example1
Count 1 (1 mark)
REPEAT (1 mark)
INPUT A[Count]
Count Count + 1 (1 mark)
UNTIL Count > 1000 (1 mark)
Example2
Count 0 (1 mark)
WHILE Count < 1000 (1 mark)
DO
Count Count + 1 (1 mark)
INPUT A[Count]
ENDWHILE (1 mark)
[4]
5 data structure (onedimensional) array .
.Reason to simplify programming/ make programs shorter/index can be used
to identify the same member across the arrays etc.
[2]
sample algorithm:
FOR x 1 TO 1000 (1 mark)
INPUT Number
Difference INT(number) Number (1 mark)
IF Difference = 0 THEN Total Total + 1 (1 mark)
NEXT x
PRINT total (1 mark)
(NOTE: alternative to lines 3 and 4:
IF INT(Number) = Number THEN Total Total + 1 (2 marks) ) [4]
(c) Description of any two sets of test data. Many correct answers, these are examples only.
900 whole numbers and 100 numbers with decimal places to ensure that the routine
distinguishes correctly [2]
(b) 1 mark for the data set and 1 mark for the matching reason all, data sets and reasons must
be different. There are many possible correct answers these are examples only.
1(c) outside loop zeroing total for loop (sum in example below)
loop for all students
input name and all test scores
in loop adding a students total
storing the total
inside loop printing students name and total
outside loop calculating class average
printing class average
sample algorithm:
Sum 0
FOR Count 1 TO 30
INPUT Name
StudentName[Count] Name
INPUT Mark1, Mark2, Mark3
StudentMarksTest1[Count] Mark1
StudentMarksTest2[Count] Mark2
StudentMarksTest3[Count] Mark3
Total Mark1 + Mark2 + Mark3
StudentTotalScore[Count] Total
Sum Sum + Total
PRINT StudentName[Count], StudentTotalScore[Count]
NEXT Count
ClassAverage = Sum/30
PRINT ClassAverage [8]