OCR A Level Computer Science Algorithms and programming (H446/02), Exams of Chemistry

OCR A Level Computer Science Algorithms and programming (H446/02)

Typology: Exams

2025/2026

Available from 04/17/2026

FocusFile7
FocusFile7 🇺🇸

4

(8)

27K documents

1 / 54

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
June 2026 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
Candidate number
First name(s)
Last name
OCR A Level Computer Science Algorithms and
programming (H446/02)
Oxford Cambridge and RSA
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

Partial preview of the text

Download OCR A Level Computer Science Algorithms and programming (H446/02) and more Exams Chemistry in PDF only on Docsity!

June 2026 – 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 Candidate number First name(s) Last name

OCR A Level Computer Science Algorithms and

programming (H446/02)

Oxford Cambridge and RSA 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.

Section A 1 Data in a computer program needs to be sorted. (a) (i) Describe the steps a bubble sort will take to sort items into ascending order. .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... ..........................................................................................................................................................

. ................................................................................................................................................... [5] (ii) Darcie and Felix have both written a program that will perform a bubble sort to put these numbers into ascending order.

Darcie’s version will complete six passes. However, Felix’s version will only need to complete two passes. Explain how Felix may have made his version more efficient than Darcie’s version. .......................................................................................................................................................... .......................................................................................................................................................... ..........................................................................................................................................................

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

© OCR 2025 (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. 01 function partition(array, low, high) 02 pivot = array[high] 03 index = low - 1 04 for count = low to high- 1 05 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^ Turn^ over (ii) Identify the type of iteration used in the function partition().

. ................................................................................................................................................... [1] (iii) Describe the role of the function partition() in the quick sort algorithm. .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... . ................................................................................................................................................... [3] (iv) The algorithm needs to be changed to sort the integer array into descending numerical order. Identify the line number that needs to be changed and write the amended line of code. Line number ................... Amended line of code ....................................................................................................................... .......................................................................................................................................................... [2] (v) The quick sort is an example of a divide-and-conquer algorithm. Describe what divide-and-conquer means. .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... . ................................................................................................................................................... [2]

© OCR 2025^ Turn^ over

(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 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]

"I"

"n" "k"

© OCR 2025^ Turn^ over (c) A pointer value of - 1 indicates that the stack is empty. The function pop() returns the next element in the stack. If the stack is empty it returns "false". The function updates the pointer value when appropriate. Write the function pop() using pseudocode or program code. .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... ..........................................................................................................................................................

. ................................................................................................................................................... [6] (d) A program is designed to reverse a set of data using the stack. The main program takes 10 characters separately as input from the user and uses the function push() to insert these into the stack. Once all 10 characters have been inserted into the stack, the program then uses the function pop() to output all 10 characters from the stack. Write the main program to achieve this using pseudocode or program code. .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... .......................................................................................................................................................... . ................................................................................................................................................... [5]

© 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^ 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 (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] 02 myArray = [7,3,6,7,5,3,2,3,6] 03 array checked[9,2] 04 checked = [[-1,0],[-1,0],[-1,0],[-1,0],[-1,0],[-1,0],[-1,0], [-1,0],[-1,0]] 05 numbersFound = 1 06 for x = 0 to myArray.length 07 found = false 08 for y = 0 to checked.length 09 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^ Turn^ over 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 (b) A balanced binary search tree has data consistently at each level, for example: An unbalanced binary search tree is uneven, for example: Describe the drawback of an unbalanced binary search tree when searching for a value. .......................................................................................................................................................... .......................................................................................................................................................... ..........................................................................................................................................................

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

© OCR 2025

(c) A different binary search tree stores the following data: Give the output that will be produced from a depth-first (post-order) traversal and a breadth-first traversal of this binary search tree. Depth-first (post-order) ..................................................................................................................... .......................................................................................................................................................... Breadth-first ...................................................................................................................................... .......................................................................................................................................................... [4]