Half p2 Cs Gcse
Half p2 Cs Gcse
Half p2 Cs Gcse
Do not use:
* 9 9 3 2 5 3 3 4 3 8 *
• a calculator
* J 2 7 7 0 2 *
First name(s)
Last name
INSTRUCTIONS
• Use black ink.
• Write your answer to each question in the space provided. If you need extra space use
the lined pages at the end of this booklet. The question numbers must be clearly shown.
• Answer all the questions.
INFORMATION
• The total mark for this paper is 80.
• The marks for each question are shown in brackets [ ].
• This document has 20 pages.
ADVICE
• Read each question carefully before you start your answer.
Tick (3) one box in each row to identify whether each statement describes a low-level
programming language or a high-level programming language.
Write pseudocode to add the integers stored in num1 and num2. Store the result in a
variable with the identifier total
...................................................................................................................................................
.............................................................................................................................................. [1]
(c) Three incomplete pseudocode algorithms are given with a description of the purpose of each
algorithm.
number = 53
if number ……………… 2 == 0 then
print("Even number")
else
print("Odd number")
endif [1]
© OCR 2023
3
(iii) Finding the difference between two measurements.
measurement1 = 300
measurement2 = 100
01 start = 3
02 do
03 print(start)
04 start = start - 1
05 until start == -1
06 print("Finished")
[3]
© OCR 2023 Turn over
4
2 This pseudocode algorithm totals all the numbers in the 0-indexed array scores
01 total = 0
02 for scoreCount = 1 to scores.length – 1
03 scores[scoreCount] = total + total
04 next scoreCount
05 print(total)
...................................................................................................................................................
...................................................................................................................................................
[2]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
[4]
© OCR 2023
5
3 An insertion sort is one type of sorting algorithm.
A student has written a pseudocode algorithm to perform an insertion sort on a 1D array names.
(a) Describe the purpose of the variable temp in the insertion sort pseudocode algorithm.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [2]
(b) An insertion sort contains a nested loop; a loop within a loop. In this pseudocode algorithm
the outer loop is a count-controlled loop and the inner loop is a condition-controlled loop.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [2]
(i) Describe one difference between an insertion sort and a bubble sort.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [2]
(ii) Describe two similarities between an insertion sort and a bubble sort.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................
[2]
© OCR 2023
7
4 A garden floodlight system uses inputs from sensors and switches to decide whether it should be
turned on.
The table shows the inputs into the system and the meaning of each input value:
The floodlight (Q) is designed to be on (Q = 1) when the switch is turned on and the motion
sensor detects motion at nighttime.
B Q
[3]
© OCR 2023
9
5 Charlie is developing an adding game. The rules of the game are:
(a) Charlie has been told that the game will need to be tested before giving it to the players.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [2]
(ii) Complete the table by naming and describing one type of test that should be used on
Charlie's program before releasing it.
[2]
(iii) Complete the table by identifying and describing two features of an IDE that can be
used when testing a program.
Feature Description
[4]
Identify two methods of validation and explain how they can be used on this game.
Use ...........................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Use ...........................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
[6]
© OCR 2023