←

Paper 2: Computational thinking, algorithms and programming

1(a)2 marks
Define abstraction and give an example of its use in a map app.
1(b)2 marks
Explain how decomposition helps when designing a large program.
1(c)4 marks
Trace the algorithm for the input 5 and state the output.
num = input("Enter number")result = 1for i = 1 to num    if i MOD 2 == 0 then        result = result * i    endifnext iprint(result)
1(d)3 marks
Show the stages of a binary search for 'Fig' in [Apple, Banana, Cherry, Date, Elder, Fig, Grape].
1(e)3 marks
Show the list [6, 2, 9, 4] after each pass of an insertion sort.
1(f)3 marks
Describe how a merge sort works.
2(a)4 marks
State the most appropriate data type for: a postcode; the number of pupils in a class; the price of a ticket; whether a ticket is paid for.
2(b)2 marks
Explain what casting is and give an example.
2(c)3 marks
word = "Computer". Using OCR Exam Reference Language, state the output of: print(word.length); print(word.substring(3, 3)); print(word.upper).
2(d)2 marks
State the values of 17 MOD 5 and 17 DIV 5.
2(e)3 marks
A table Books has fields Title, Author, Year and Copies. Write an SQL query to show the title and author of books published after 2015.
2(f)2 marks
seats is a 2D array of 10 rows and 20 columns storing True if a seat is booked. Write a statement to book the seat in row 3, column 7, and one to output whether row 0, column 0 is booked.
2(g)1 mark
Write a statement that stores a random integer from 1 to 100 in a variable called guess.
3(a)3 marks
Describe three ways to make a program more maintainable.
3(b)4 marks
A program accepts a quantity from 1 to 10 inclusive. Complete a test plan with one test each for normal, boundary, invalid and erroneous data, and the expected outcome.
3(c)2 marks
Explain the difference between iterative and final testing.
4(a)4 marks
Complete the truth table for P = (A AND B) OR (NOT A AND C) for the inputs A, B, C = 000, 001, 011, 100, 110, 111.
4(b)1 mark
Name the logic gate that outputs 1 only when both inputs are 1.
52 marks
Describe two features of an IDE that help programmers find errors.
6(a)2 marks
Section B (answer in OCR Exam Reference Language or a high-level language). A car park charges £2.50 per hour, with a maximum of £12 per day. Blue-badge holders park free. Identify two inputs the program will need.
6(b)6 marks
Write a function charge(hours, badge) that returns the parking charge.
6(c)4 marks
Give the expected return value of charge for: 3 hours, no badge; 6 hours, no badge; 2 hours, badge; and state why the second test is useful.
7(a)3 marks
The array times stores the 100 m times (seconds) of 8 runners: [13.2, 12.8, 14.1, 12.5, 13.9, 12.9, 15.0, 13.4]. Write code to output the number of runners with a time under 13.0 seconds.
7(b)6 marks
Write a procedure that outputs the fastest time and the position (index) in the array of that runner.
7(c)9 marks
Write a program that asks for each runner's name and time for 8 runners, validates that each time is between 9.0 and 30.0, stores them in two arrays, and outputs the names of runners whose time is below the mean time, followed by the mean to 2 decimal places.

Finished?

Answer every question to finish (25 left), or finish when the time’s up.

Score 0 / 80 · 0 of 25 marked

This paper is written by Plasmo in the style of the OCR GCSE Computer Science exam. It is not a past paper and is not produced or endorsed by the exam board.

OCR GCSE Computer Science Mock Exam: Paper 2: Computational thinking, algorithms and programming | Plasmo