0% found this document useful (0 votes)
71 views

Specimen QP - Paper 2 OCR Computer Science GCSE

This document contains a sample exam paper for GCSE Computer Science. It has multiple choice and written response questions testing computational thinking, algorithms, and programming concepts. The questions cover topics like: 1) Completing truth tables and logic diagrams for Boolean statements 2) Writing pseudocode and algorithms to solve problems like comparing numbers and repeating calculations 3) Writing SQL queries to retrieve data from a database table 4) Analyzing and updating flowcharts and algorithms for generating usernames based on name inputs The exam paper tests a range of core computing principles and problem-solving skills through 20 pages of questions with varying point values. Clear instructions are provided on how to answer the questions and manage time during the exam.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views

Specimen QP - Paper 2 OCR Computer Science GCSE

This document contains a sample exam paper for GCSE Computer Science. It has multiple choice and written response questions testing computational thinking, algorithms, and programming concepts. The questions cover topics like: 1) Completing truth tables and logic diagrams for Boolean statements 2) Writing pseudocode and algorithms to solve problems like comparing numbers and repeating calculations 3) Writing SQL queries to retrieve data from a database table 4) Analyzing and updating flowcharts and algorithms for generating usernames based on name inputs The exam paper tests a range of core computing principles and problem-solving skills through 20 pages of questions with varying point values. Clear instructions are provided on how to answer the questions and manage time during the exam.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

PMT

…day … Month Year – Morning/Afternoon


GCSE (9–1) Computer Science
J277/02 Computational thinking, algorithms and programming
Time allowed: 1 hour 30 minutes

Sample Question paper


Do not use: Version 1.3
• a calculator

Please write clearly in black ink. Do not write in the barcodes.

Centre number Candidate number

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 to answer.

© OCR 2019 […/…/…] OCR is an exempt Charity


DC (…) 000000 Turn over
PMT

BLANK PAGE

© OCR 2019
PMT

Answer all the questions.

Section A

1 (a) Complete the truth table in Fig. 1 for the Boolean statement P = NOT(A AND B).

A B P

0 0 1

0 1
…………………………………
1 0
…………………………………
1 1 0

Fig. 1
[2]

(b) Tick () one box to identify the correct logic diagram for P = NOT(A AND B).

P = NOT(A AND B) Tick () one box

[1]
© OCR 2019 Turn over
PMT

2 A program needs to perform the following tasks:

• Input two numbers from the user


• Compare both numbers and output the largest number.

(a) Complete the pseudocode for this program.

num1 = ………………………………………………

num2 = input("enter second number")

……………………… num1 > ……………………… then

………………………………………………

else

………………………………………………

endif [5]

(b) A second program needs to perform the following tasks:

• Input a number from the user


• Double the number input and print the result
• Repeat bullets 1 and 2 until the user enters a number less than 0.

Write an algorithm for this program.

……………………………………………………………………………………………………………

……………………………………………………………………………………………………………

……………………………………………………………………………………………………………

……………………………………………………………………………………………………………

……………………………………………………………………………………………………………

……………………………………………………………………………………………………………

……………………………………………………………………………………………………………

……………………………………………………………………………………………………………

……………………………………………………………………………………………………………

……………………………………………………………………………………………………………

……………………………………………………………………………………………………………

[5]
© OCR 2019
PMT

3 The database table Results stores the results for each student in each of their chosen subjects.

StudentName Subject Grade


Alistair English 3
Jaxon Art 5
Alex Art 4
Anna French 7
Ismaael Art 9

Complete the SQL query to return all of the fields for the students who take Art.

SELECT ……………………………………………………………….…………….…….…….…………

FROM ……………………………………………………………….…………….…….…….…………

WHERE ……………………………………………………………….…………….…….…….…………

[3]

© OCR 2019 Turn over


PMT

4 A program creates usernames for a school. The first design of the program is shown in the
flowchart in Fig. 2.

Start

INPUT
firstName

INPUT
surname

name = first three letters


of firstName

username = name + first


two letters of surname

OUTPUT
username

Stop

Fig. 2

For example, using the process in Fig. 2, Tom Ward’s username would be TomWa.

(a) State, using the process in Fig. 2, the username for Rebecca Ellis.

……………………………………………………………………………………………………………. [1]

© OCR 2019
PMT

(b) The program design is updated to create usernames as follows:

• If the person is a teacher, their username is the last 3 letters of their surname and then
the first 2 letters of their first name.
• If the person is a student, their username is the first 3 letters of their first name and then
the first 2 letters of their surname.

(i) What would be the username for a teacher called Fred Biscuit using the updated
process?

……………………………………………………………………………….……………………... [1]

(ii) Write an algorithm for the updated program design shown in question 4(b)(i).

……………………………………………………………………………………………..……………

……………………………………………………………………………………………..……………

……………………………………………………………………………………………..……………

……………………………………………………………………………………………..……………

……………………………………………………………………………………………..……………

……………………………………………………………………………………………..……………

……………………………………………………………………………………………..……………

……………………………………………………………………………………………..……………

……………………………………………………………………………………………..……………

……………………………………………………………………………………………..……………

……………………………………………………………………………………………..……………

……………………………………………………………………………………………..……………

……………………………………………………………………………………………..……………

……………………………………………………………………………………………..……………

……………………………………………………………………………………………..……………

……………………………………………………………………………………………..……………

……………………………………………………………………………………………..……………

…………………………………………………………………………………………….…………….
[6]

© OCR 2019 Turn over


PMT

5 A computer game is written in a high-level programming language.

(a) State why the computer needs to translate the code before it is executed.

……………………………………………………………………………………………………………….. [1]

(b) Either a compiler or an interpreter can translate the code.


Describe two differences between how a compiler and an interpreter would translate the
code.

1 ..……………………………………………………………………………………………………………..

……………………………………………………………………………………………………………..…..

………………………………………………………………………………………………..………………..

……………………………………………………………………………………………..…………………..

2 ……………………………………………………………………………………………………………….

……………………………………………………………………………………………..…………………..

……………………………………………………………………………………………..…………………..

………………………………………………………………………………………………………………….
[4]

© OCR 2019
PMT

6 A program uses a file to store a list of words that can be used in a game.

A sample of this data is shown in Fig. 3.

crime bait fright victory nibble loose

Fig. 3

(a) Show the stages of a bubble sort when applied to data shown in Fig. 3.

………………………………………………………………………………………………………………..

………………………………………………………………………………………………………………..

………………………………………………………………………………………………………………..

………………………………………………………………………………………………………………..

………………………………………………………………………………………………………………..

………………………………………………………………………………………………………………..

………………………………………………………………………………………………………………..

………………………………………………………………………………………………………………..

[4]

(b) A second sample of data is shown in Fig. 4.

amber house kick moose orange range tent wind zebra

Fig. 4

Show the stages of a binary search to find the word zebra using the data shown in Fig. 4.

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………

[4]

© OCR 2019 Turn over


PMT

10

7 The area of a circle is calculated using the formula π × r2 where π is equal to 3.142 and r is the
radius.

A program is written to allow a user to enter the radius of a circle as a whole number between
1 and 30, then calculate and output the area of the circle.

01 radius = 0
02 area = 0.0
03 radius = input("Enter radius")
04 if radius < 1 OR radius > 30 then
05 print("Sorry, that radius is invalid")
06 else
07 area = 3.142 * (radius ^ 2)
08 print (area)
09 endif

(a) Explain, using examples from the program, two ways to improve the maintainability of the
program.

1 ……………………………………………………………………………………………………………….

………………………………………………..………………………………………………………………..

……………………………………………………………..…………………………………………………..

………………………………………………………………..………………………………………………..

2 ……………………………………………………………………………………………………………….

…………………………………………………………………..……………………………………………..

……………………………………………………………………..…………………………………………..

………………………………………………………………………………………………………..………..
[4]

(b) Identify two variables used in the program.

1 ………………………………………………………………………………………………………………

2 …………………………………………………………………………………………………………..…..
[2]

© OCR 2019
PMT

11

(c) (i) Identify one item in the program that could have been written as a constant.

………………………………………………………………………………………………………. [1]

(ii) Give one reason why you have identified this item as a constant.

……………………………………………………………………………………………………… [1]

(d) Tick () one box in each row to identify whether each programming construct has or has not
been used in the program.

Has been used Has not been used

Sequence

Selection

Iteration
[3]

(e) An Integrated Development Environment (IDE) is used to write the program.

Identify two features of an IDE that might be used when writing the program.

1 ……………………………………………………………………………………………………………….

……………………………………………………………………………………………………………..…..

2 ……………………………………………………………………………………………………………….

………………………………………………………………………………………………………..………...
[2]

© OCR 2019 Turn over


PMT

12

Section B

We advise you to spend at least 40 minutes on this section.

Some questions require you to respond using either the OCR Exam Reference Language or a
high-level programming language you have studied. These are clearly shown.

8 A teacher researches the length of time students spend playing computer games each day.

(a) Tick () one box to identify the data type you would choose to store the data and explain
why this is a suitable data type.

Data Type Tick () one box

String

Integer

Real

Boolean

Explanation: ……………………………………………………………………………………………….

…………………………………….………………………………………………….……………………..

[2]

© OCR 2019
PMT

13

(b) The program should only allow values from 0 to 300 inclusive as valid inputs. If the data entered
breaks this validation rule, an error message is displayed.

(i) Complete the following program to output "Invalid input" if the data does not meet
the validation rule.

You must use either:


• OCR Exam Reference Language, or
• a high-level programming language that you have studied.

mins = input("Enter minutes played: ")

if mins < 0 …………………… mins …………………… then

…………………………… ("Invalid input")

endif

[3]

(ii) Complete the following test plan for the program in 8(b)(i).

Test data Test type Expected result

25 Normal Value accepted

Invalid input
Invalid
message displayed

300 Boundary

[2]

© OCR 2019 Turn over


PMT

14

(c) Data for one week (Monday to Friday) is stored in a 2D array with the identifier minsPlayed.

The following table shows part of this array, containing 4 students.

Students
Stuart Wes Victoria Dan
0 1 2 3
Days Mon 0 60 30 45 0
of the
week Tue 1 180 60 0 60
Wed 2 200 30 0 20
Thu 3 60 10 15 15
Fri 4 100 35 30 45

The teacher wants to output the number of minutes Dan (column index 3) played computer
games on Wednesday (row index 2). The following code is written:

print(minsPlayed[3,2])

Write a line of code to output the number of minutes that Stuart played computer games on
Friday.

You must use either:


• OCR Exam Reference Language, or
• a high-level programming language that you have studied.

…………………………………………………………………………………………………………

……………………………………………………………………………………………………… [1]

© OCR 2019
PMT

15

(d) The teacher writes a program to add up and print out the total number of minutes student 2 played
computer games over 5 days (Monday to Friday).

total = 0

total = total + minsPlayed[2,0]

total = total + minsPlayed[2,1]

total = total + minsPlayed[2,2]

total = total + minsPlayed[2,3]

total = total + minsPlayed[2,4]

print(total)

Refine the program to be more efficient. Write the refined version of the algorithm.

You must use either:


• OCR Exam Reference Language, or
• a high-level programming language that you have studied.

………………………………………………………………………………………………………………..

………………………………………………………………………………………………………………..

………………………………………………………………………………………………………………..

………………………………………………………………………………………………………………..

………………………………………………………………………………………………………………..

………………………………………………………………………………………………………………..

………………………………………………………………………………………………………………..

………………………………………………………………………………………………………………..

………………………………………………………………………………………………………………..

………………………………………………………………………………………………………………..

………………………………………………………………………………………………………………..

………………………………………………………………………………………………………………..

[4]

© OCR 2019 Turn over


PMT

16

(e) The following program uses a condition-controlled loop.

x = 15

y = 0

while x > 0

y = y + 1

x = x – y

endwhile

print(y)

Complete the trace table to test this program.

x y output

[4]

© OCR 2019
PMT

17

(f) A teacher writes an algorithm to store the name of the game a student plays each night (for
example "OCR Zoo Simulator").

variable.length returns the number of characters in variable.


variable.upper returns the characters in variable in upper case.

valid = false

while(valid == false)

gameName = input("Enter the game name")

if (gameName.length > 0) AND (gameName.length < 20)

gamesPlayed = gameName.upper

valid = true

print("Valid game name")

else

print("Game name is not valid")

endif

endwhile

The algorithm needs testing to make sure the IF-ELSE statement works correctly.

Identify two different pieces of test data that can be used to test different outputs of the
algorithm. Give the output from the program for each piece of test data.

Test data 1 ..…………………………………………………………………………………………..

Expected output ..……………………………………………………………………………………..

Test data 2 …………………………………………………………………………………………….

Expected output ..……………………………………………………………………………………..


[4]

© OCR 2019 Turn over


PMT

18

(g) The teacher asks students how long they spend completing homework. Students answer in
minutes and hours (for example 2 hours 15 minutes).

The teacher would like to create an algorithm that will display students’ inputs in minutes only.

(i) Identify the input and output required from this algorithm.

Input …….………………………………………………………………………………………………

……...……………………………………………………………………………………………………

Output …..………………………………………………………………………………………………

…….………………………………………………………………………….……………………........
[2]

(ii) A program is created to convert hours and minutes into a total number of minutes.

The teacher wants to create a sub program to perform the calculation.

The program has been started but is not complete.

Complete the design for the program.

hours = input("Please enter number of hours played")

minutes = input("Please enter number of minutes played")

finalTotal = ………………………………………………………………..

print(finalTotal)

function ………………………………………………………………..

………………………………………………………………..

………………………………………………………………..

………………………………………………………………..

………………………………………………………………..

endfunction

[4]

© OCR 2019
PMT

19

(iii) The following flowchart outputs a message depending on how long each person has spent
playing computer games.

Rewrite the flowchart as a program.

You must use either:


• OCR Exam Reference Language, or
• a high-level programming language that you have studied.

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………

[4]

END OF QUESTION PAPER

© OCR 2019
PMT

20

ADDITIONAL ANSWER SPACE

If additional space is required, you should use the following lined page(s). The question
number(s) must be clearly shown in the margin(s).

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Copyright Information:

OCR is committed to seeking permission to reproduce all third-party content that it uses in the assessment materials. OCR has attempted to
identify and contact all copyright holders whose work is used in this paper. To avoid the issue of disclosure of answer-related information to
candidates, all copyright acknowledgements are reproduced in the OCR Copyright Acknowledgements booklet. This is produced for each
series of examinations and is freely available to download from our public website (www.ocr.org.uk) after the live examination series.

If OCR has unwittingly failed to correctly acknowledge or clear any third-party content in this assessment material, OCR will be happy to correct
its mistake at the earliest possible opportunity.

For queries or further information please contact the Copyright Team, The Triangle, Shaftesbury Road, Cambridge, CB2 8EA.

OCR is part of the Cambridge Assessment Group; Cambridge Assessment is the brand name of University of Cambridge Local Examinations
Syndicate (UCLES), which is itself a department of the University of Cambridge.

© OCR 2019

You might also like