2O25 OCR A Level Computer Science H446/02 Algorithms and programming, Exams of Computer science

2O25 OCR A Level Computer Science H446/02 Algorithms and programming Verified Question paper with Marking Scheme combined INSTRUCTIONS • Use black ink. You can use an HB pencil, but only for graphs and diagrams. • Write your answer to each question in the space provided. If you need extra space use the lined page 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 140. • The marks for each question are shown in brackets [ ]. • Quality of extended response will be assessed in questions marked with an asterisk (*). • This document has 32 pages. ADVICE • Read each question carefully before you start your answer.

Typology: Exams

2025/2026

Available from 12/07/2025

christopher-godwin
christopher-godwin 🇬🇧

351 documents

1 / 64

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
OCR A LEVEL
COMPUTER
SCIENCE
2O25 OCR A Level Computer Science
H446/02 Algorithms and programming
Verified Question paper with Marking
Scheme combined
INSTRUCTIONS
Use black ink. You can use an HB pencil,
but only for graphs and diagrams.
Write your answer to each question in
the space provided. If you need extra space use
the lined page 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 140.
The marks for each question are shown
in brackets [ ].
Quality of extended response will be
assessed in questions marked with an asterisk
(*).
This document has 32 pages.
ADVICE
Read each question carefully before you
start your answer.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40

Partial preview of the text

Download 2O25 OCR A Level Computer Science H446/02 Algorithms and programming and more Exams Computer science in PDF only on Docsity!

OCR A LEVEL

COMPUTER

SCIENCE

2O25 OCR A Level Computer Science

H446/02 Algorithms and programming

Verified Question paper with Marking

Scheme combined

INSTRUCTIONS

  • Use black ink. You can use an HB pencil,

but only for graphs and diagrams.

  • Write your answer to each question in

the space provided. If you need extra space use

the lined page 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 140.
  • The marks for each question are shown

in brackets [ ].

  • Quality of extended response will be

assessed in questions marked with an asterisk

  • This document has 32 pages.

ADVICE

  • Read each question carefully before you

start your answer.

Oxford Cambridge and RSA Wednesday 18 June 2025 – Morning A Level Computer Science

H446/02 Algorithms and programming

Time allowed: 2 hours 30 minutes You can use:

  • a ruler (cm/mm)
  • an HB pencil Do not use:
  • a calculator Please write clearly in black ink. Do not write in the barcodes. Centre number First name(s) Last name Candidate number INSTRUCTIONS
  • Use black ink. You can use an HB pencil, but only for graphs and diagrams.
  • Write your answer to each question in the space provided. If you need extra space use the lined page 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 140.
  • The marks for each question are shown in brackets [ ].
  • Quality of extended response will be assessed in questions marked with an asterisk (*).
  • This document has 32 pages. ADVICE
  • Read each question carefully before you start your answer. © OCR 2025 [601/4911/5] OCR is an exempt Charity DC (PQ/CGW) 337417/5 Turn over

(b) A second type of sorting algorithm is an insertion sort. Describe how an insertion sort can be used to put the following data into ascending order. 20 8 15 36 .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... ..................................................................................................................................................... [5] © OCR 2025 Turn over

(c) A third type of sorting algorithm is a quick sort. The following quick sort algorithm is made up of two functions called partition() and quickSort(). The algorithm will sort an integer array into ascending numerical order. 1 function partition(array, low, high) 2 pivot = array[high] 3 index = low - 1 4 for count = low to high- 1 5 if array[count] < pivot then 06 index = index + 1 07 temp = array[index] 08 array[index] = array[count] 09 array[count] = temp 10 endif 11 next count 12 temp = array[index + 1] 13 array[index + 1] = array[high] 14 array[high] = temp 15 return index + 1 16 endfunction 17 18 function quickSort(array, low, high) 19 if low < high then 20 partitionIndex = partition(array, low, high) 21 quickSort(array, low, partitionIndex - 1) 22 quickSort(array, partitionIndex + 1, high) 23 endif 24 endfunction (i) Identify which of the two functions is recursive and give all of the line numbers where recursive calls are made. Recursive function name .................................................................................................................. Recursive call line numbers ............................................................................................................. [2] © OCR 2025

2* A shopping website requires customers to create a username and password. (a) The usernames and passwords are stored securely in a file. The file contains the username and passwords for 50 million users which are sorted in alphabetical order by username. The file can be searched using a linear search or a binary search. The big-O complexities for a linear search and a binary search are given in the table: Search Worst-case Average-case Worst-case algorithm time time space Linear O(n) O(n) O(1) Binary O(log n) O(log n) O(1) Compare the use of a linear search and a binary search in this scenario. You should include the following in your answer:

  • the features and preconditions of a linear and binary search
  • the benefits and drawbacks of each search in this scenario
  • a conclusion justifying which search algorithm should be used in this scenario. You should make reference to the big-O complexities in your answer. [9] .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... © OCR 2025

(b) The website collects data from customers’ activities once they log on. For example, the items they view and purchase. The company that owns the website would like to use data mining to improve their website and customer experience. (i) Describe what data mining means. .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... ..................................................................................................................................................... [3] (ii) Explain how the company can make use of data mining to improve their website and customer experience. .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... ..................................................................................................................................................... [2] © OCR 2025 Turn over

3 A program is designed to use a stack data structure. The current contents of part of the stack and its current pointer value are shown: 5 4 3 2 1 0 "I" "n" "k" pointer = 2 (a) Show the contents of the stack and its pointer value after the data items "t" and "s" are inserted in the order given. 5 4 3 2 1 0 pointer = ................... [2] © OCR 2025 Turn over

(b) The stack is stored using a 0-based 1-dimensional array called theStack with 20 elements. The function push() stores its parameter into the next space in the stack if it is not full. The function returns true if it is successfully stored and returns false if the stack is full. Complete the function push() using pseudocode or program code. function push(data) if pointer == ..................................................................... then return false else pointer = ..................................................................... theStack[pointer] = ..................................................................... ..................................................................... endif endfunction [4] © OCR 2025

4* A processor is being designed to use pipelining and will need to be able to process millions of instructions. For each instruction the following stages will be performed: A the instruction will be fetched from memory B the instruction will be decoded C the instruction will be executed The first four instructions to be processed will be instructions 1, 2, 3 and 4. The design allocates 1-time interval for each of the three stages A, B, C. Discuss the use of pipelining by this processor. You should include the following in your answer:

  • the features of pipelining
  • how pipelining can be used to manage the first four instructions
  • a conclusion justifying the use of pipelining in this scenario. [9] .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... © OCR 2025

© OCR 2025 Turn over

(b) A user needs to travel from planet A to planet H. They need to travel the least expensive route. Show how Dijkstra’s algorithm can be used on the directed graph shown in Fig. 5 to find the shortest path from start planet A to the end planet H. You must state the nodes on the final path and the distance of this path. Show your working. You may use the table to give your answer. .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... Node Distance travelled^ Previous node Final path: ........................................................................................................................................ Distance: .......................................................................................................................................... [7] © OCR 2025 Turn over

(c) The A* algorithm can also be used to find the shortest path in a graph. Describe how an A* algorithm uses heuristics to be an efficient algorithm. .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... ..................................................................................................................................................... [2] 6 A student is writing a program in a high-level programming language. (a) The student writes the program using an Integrated Development Environment (IDE). Complete the table by identifying and describing three features of an IDE that the student can use to debug their program. Debugging feature Description ................................................................................................. .............................................. ................................................................................................. .............................................. ................................................................................................. ................................................................................................. ................................................................................................. .............................................. ................................................................................................. .............................................. ................................................................................................. ................................................................................................. ................................................................................................. .............................................. ................................................................................................. .............................................. ................................................................................................. ................................................................................................. [6] © OCR 2025

(d) An algorithm is needed to count how many times each of the numbers from 1 to 9 appear in an array called myArray. Another array called checked is used to store each number found in myArray and the number of times it appears. For example, the contents of myArray are: 7 3 6 7 5 3 2 3 6 Based on these contents in myArray, the contents in checked would be: 7 2 3 3 6 2 5 1 2 1

  • 1 0
  • 1 0
  • 1 0
  • 1 0
  • 1 indicates an unused space in the array as the numbers 1, 4, 8 and 9 have not been found. The student has written the following pseudocode for this program. The pseudocode contains several errors. 01 array myArray[9] 2 myArray = [7,3,6,7,5,3,2,3,6] 3 array checked[9,2] 4 checked = [[-1,0],[-1,0],[-1,0],[-1,0],[-1,0],[-1,0],[-1,0], [-1,0],[-1,0]] 05 numbersFound = 1 6 for x = 0 to myArray.length 7 found = false 8 for y = 0 to checked.length 9 if checked[y,0] == myArray[y] then 10 checked[y,1] = checked[y,1] + 1 11 found = true 12 endif 13 next y 14 if found == true then 15 checked[numbersFound,0] = myArray[x] 16 checked[numbersFound,1] = 0 17 numbersFound = numbersFound + 1 18 endif 19 next y © OCR 2025

Identify the line number of any four errors and write the corrected line for each error. Error 1 Line number ................... Corrected line ................................................................................................................................... Error 2 Line number ................... Corrected line ................................................................................................................................... Error 3 Line number ................... Corrected line ................................................................................................................................... Error 4 Line number ................... Corrected line ................................................................................................................................... [4] © OCR 2025 Turn over