OCR A-Level Computer Science (H446/02)
Question Recall – QUESTIONS ONLY (with mark allocations)
Q1. Algorithms [21 marks]
a) Explain how the bubble sort algorithm works to sort a given list. [5]
b) Student A’s algorithm takes 6 passes to sort the list; Student B’s takes 2. Explain one way
Student B could have made their algorithm more efficient. [2]
c) Using the list, demonstrate how the insertion sort algorithm would sort the list in ascending order.
[5]
d) QuickSort:
i) Identify which function is recursive and specify the line numbers where the recursive calls occur.
[2]
ii) State the purpose of the partition function in QuickSort. [3]
iii) Indicate the line number and modified code required to make the algorithm sort in descending
order. [1]
iv) Explain “divide and conquer” in the context of QuickSort. [2]
Q2. Algorithms Continued [14 marks]
a) State the type of iteration used in the algorithm with nested loops. [1]
b) Identify four errors in the digit-counting algorithm. [4]
c) Discuss the suitability of binary vs linear search for a 50■million■record file sorted by username.
[9]
Q3. Stacks and Pipelining [24 marks]
a) State the value of the stack pointer and contents after pushing 't' and 's'. [2]
b) Complete the stack push function. [4]
c) Write the pop function including an empty-check. [4]
d) Write a main program that inputs 10 values, pushes to a stack, then outputs in reverse. [5]
e) Extended response: Explain pipelining and how it improves performance. [9]
Q4. Graphs [11 marks]
a) Explain why a graph is appropriate to represent planets and routes. [2]
b) Apply Dijkstra’s algorithm to the given graph to find shortest path. [7]
c) Explain how A* uses heuristics for efficiency. [3]
Q5. Trees [9 marks]
a) Show the binary tree after inserting given values. [3]
b) Breadth■first traversal order. [2]
c) Post■order traversal. [2]
d) Compare search efficiency of balanced vs unbalanced BST. [2]
Q6. Computational Techniques [19 marks]
a) Define data mining. [3]
b) Explain how data mining improves customer experience. [2]
c) State three debugging■related IDE features. [6]
d) Define global vs local variables. [2]
e) State one drawback of global variables. [2]
f) State one drawback of local variables. [2]
g) Explain passing by value. [2]
Q7. OOP & Linked Lists [37 marks]
a) Describe features of a linked list. [5]
b) Complete OutputList subroutine. [5]
c) Write GetNextNode(). [2]
d) Write SetValue(). [3]
e) Write constructor setting headNode to null. [2]
f) Algorithm inserting values (10, x, y) then output list. [5]
g) Describe how to delete a node from a linked list. [5]
h) Name three other computational methods besides divide & conquer. [3]
i) Extended response: Compare linked list via OOP vs 2D array. [12]