←

Programming fundamentals

From Paper 2: Computational thinking, algorithms and programming
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.
From Paper 2: Computational thinking, algorithms and programming
2(b)2 marks
Explain what casting is and give an example.
From Paper 2: Computational thinking, algorithms and programming
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).
From Paper 2: Computational thinking, algorithms and programming
2(d)2 marks
State the values of 17 MOD 5 and 17 DIV 5.
From Paper 2: Computational thinking, algorithms and programming
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.
From Paper 2: Computational thinking, algorithms and programming
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.
From Paper 2: Computational thinking, algorithms and programming
2(g)1 mark
Write a statement that stores a random integer from 1 to 100 in a variable called guess.
From Paper 2: Computational thinking, algorithms and programming
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.
From Paper 2: Computational thinking, algorithms and programming
6(b)6 marks
Write a function charge(hours, badge) that returns the parking charge.
From Paper 2: Computational thinking, algorithms and programming
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.
From Paper 2: Computational thinking, algorithms and programming
7(b)6 marks
Write a procedure that outputs the fastest time and the position (index) in the array of that runner.
From Paper 2: Computational thinking, algorithms and programming
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.
Score 0 / 43 · 0 of 12 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.

Programming fundamentals Exam Questions: OCR GCSE Computer Science | Plasmo