Question bank › GCSE Computer Science › Programming fundamentals

Arrays, records and SQL

Answer on paper first, then reveal the mark scheme one mark at a time.

1Grade 6–76 marks

A weather station records 10 temperatures each day.

Write a program that:

• asks the user to enter 10 temperatures and stores them in an array

• calculates and outputs the mean temperature

• outputs how many temperatures are above 20.

Use OCR Exam Reference Language or a high-level programming language. [6]

2Grade 4–54 marks

A database table called Pupils is shown.

PupilIDFirstNameSurnameYearPoints
1AmirKhan1064
2BellaHughes1145
3ChenLi1038
4DaraOkafor1172
5EllaPatel1055

(a) Write an SQL statement to display the FirstName and Points of every pupil in Year 11. [3]

(b) State the output of this SQL statement:

SELECT Surname FROM Pupils WHERE Year = 10 AND Points > 50

[1]

3Grade 6–76 marks

A 2D array marks stores test marks for 3 students (rows 0–2) in 4 tests (columns 0–3). marks[student, test] is used to access a value.

Test 0Test 1Test 2Test 3
Student 01215918
Student 17142011
Student 216101319

(a) State the value of marks[1, 2]. [1]

(b) Write code that calculates and outputs the total mark for each student. Use OCR Exam Reference Language or a high-level programming language. [5]

Still losing marks on this topic?

Book a free introductory session and we'll find exactly which step is costing you.

Book a free intro