BREAKING
Student's code works, nobody knows why, including student★Local teen writes pseudocode, accidentally invents a language★Binary joke told in class, exactly 10 students laugh★
  1. Home
  2. A Level
  3. Computer Science
  4. OCR
  5. Thinking ahead

OCR A Level Computer Science

Topic questions Algorithms Thinking ahead

Thinking ahead

5 questions · 113 marks · about 2 hours

Thinking ahead questions

OCR H446 Thinking ahead 5 questions

Algorithms and programming June 2025, Question 8 40 marks

Also involves Arrays · Linked lists

A linked list data structure is designed using object-oriented programming.

The design includes two classes called node and linkedList.

(a)

Describe the features of a linked list data structure.

[3]
Reveal mark scheme Mark scheme for question 8(a)
(b)

The class design for node is shown here.

Figure for question 8

new() is the constructor method. The constructor method takes a parameter and assigns this to the value attribute.

(b)(i)

The method getNextNode() returns the attribute nextNode.

Write the method getNextNode() using pseudocode or program code.

[2]
Reveal mark scheme Mark scheme for question 8(b)(i)
(b)(ii)

The method setValue() takes an integer as a parameter and assigns this to the attribute value

Write the method setValue() using pseudocode or program code.

[3]
Reveal mark scheme Mark scheme for question 8(b)(ii)
(c)

The class design for linkedList is shown here.

Figure for question 8

new() is the constructor method. The constructor initialises the attribute headNode to a null value.

(c)(i)

Write the constructor method using pseudocode or program code.

[2]
Reveal mark scheme Mark scheme for question 8(c)(i)
(c)(ii)

The class design for node and linkedList are shown again here for your reference.

Figure for question 8

The method getValue() will return the value of a node. The method getNextNode() will return the next node to be accessed in the linked list.

The method outputList() traverses the linked list starting at the node headNode. The method joins the data in each node and returns it.

Complete the method outputList() using pseudocode or program code.

Figure for question 8
[5]
Reveal mark scheme Mark scheme for question 8(c)(ii)
(d)

The method insertNode() will insert a new node into the linked list.

The method accepts an integer as a parameter, creates a new node with that data and inserts it into the linked list, e.g. insertNode(8) creates a node object with the data 8 and adds it to the linked list.

The program needs to store the following data items in the linked list in the order they are given: 10 25 39

The program then needs to output all of the data in the list using the appropriate method.

Write an algorithm using pseudocode or program code to:

• create a new linkedList object with the identifier createList

• insert each of the data items into the linked list (10, 25, 39)

• output the content of the linked list.

[5]
Reveal mark scheme Mark scheme for question 8(d)
(e)

A new method is needed to remove a node from the linked list. The method needs to take the data to remove as a parameter and then find this data in the linked list before removing the node.

Describe the steps that this method will need to follow and the decisions that need to be made in the method to remove the correct node.

[5]
Reveal mark scheme Mark scheme for question 8(e)
(f)

The program developer made use of computational methods when designing the object-oriented programming solution. One computational method is divide-and-conquer.

Identify three other computational methods that the program developer could have used.

[3]
Reveal mark scheme Mark scheme for question 8(f)
(g)

* This program uses classes and objects to create a linked list.

An alternative method is creating a 2-dimensional array. In this design the first index stores the data and the second element stores the index of the next data item. Array elements not currently used are also linked together to form a chain of empty values to identify where the next data item can be inserted.

Compare the two different methods of creating a linked list that have been described.

You should include the following in your answer:

• the features of both methods including the reusability of program components

• benefits and drawbacks of both methods in this program

• a conclusion evaluating the efficiency of both methods when designing a program that needs

a linked list.

[12]
Reveal mark scheme Mark scheme for question 8(g)

Algorithms and programming June 2023, Question 4 8 marks

Also involves Variables, constants, inputs, outputs and assignment · String manipulation

A programmer has designed a program that includes a reusable program component.

(a)

The reusable program component is a function called isInteger(). This will take a string as an argument and then check that each digit is between 0 and 9. For example if 103 is input, it will check that the digits 1, 0 and 3 are each between 0 and 9.

The asc() function returns the ASCII value of each digit. For example asc("1") returns 49.

The ASCII value for 0 is 48. The ASCII value for 9 is 57.

Figure for question 4
(a)(i)

Identify one identifier used in the function isInteger().

[1]
Reveal mark scheme Mark scheme for question 4(a)(i)
(a)(ii)

Give the line number where the branching (selection) construct starts in the function isInteger().

[1]
Reveal mark scheme Mark scheme for question 4(a)(ii)
(a)(iii)

Give the line number where the iteration construct starts in the function isInteger()

[1]
Reveal mark scheme Mark scheme for question 4(a)(iii)
(b)

Describe the purpose of the following lines in the function isInteger().

Line 03........

Line 04........

Line 09........

[3]
Reveal mark scheme Mark scheme for question 4(b)
(c)

Give two reasons why reusable program components are used in programs.

[2]
Reveal mark scheme Mark scheme for question 4(c)

Algorithms and programming June 2019, Question 7 40 marks

Figure for question 7
(a)

The programmer will use abstraction to produce the program interface to represent the garden.

(a)(i)

Give two different examples of how abstraction has been used to produce the layout of the garden.

[2]
Reveal mark scheme Mark scheme for question 7(a)(i)
(a)(ii)

Explain the need for abstraction in the production of this program.

[3]
Reveal mark scheme Mark scheme for question 7(a)(ii)
(a)(iii)

The user needs to input data into the program to set up their garden layout.

Identify three pieces of data that the user may input into this program.

[3]
Reveal mark scheme Mark scheme for question 7(a)(iii)
(b)

The program is to be built using object oriented programming.

All items that can be added to the garden are declared as instances of the class GardenItem

The class has the following attributes:

Figure for question 7
(b)(i)

The constructor method sets the attributes to values that are passed as parameters.

Write pseudocode or program code to declare the class GardenItem and its constructor. All attributes should be private and initialised through the constructor (e.g. daisies =

new GardenItem("Flowerbed",2,1) maths symbol

[4]
Reveal mark scheme Mark scheme for question 7(b)(i)
(b)(ii)

The trees in the garden layouts are defined by the class Tree. This class inherits from GardenItem.

The class Tree has the additional attributes: height, sun, shade.

If sun is true then the tree can grow in full sun, if it is false then it cannot.

If shade is true then the tree can grow in full shade, if it is false then it cannot.

The length and width of a tree are the same. Only one value for these measurements is passed to the constructor.

Write an algorithm, using pseudocode or program code, to declare the class Tree Declare all attributes as private.

[5]
Reveal mark scheme Mark scheme for question 7(b)(ii)
(b)(iii)

The Common Oak is a type of tree. It has a maximum height, length and width of 40 m. It can grow in sun and shade.

Write a statement, using pseudocode or program code, to declare an instance of tree for the Common Oak. Give the object the identifier firstTree.

[4]
Reveal mark scheme Mark scheme for question 7(b)(iii)
(b)(iv)

The classes GardenItem and Tree use get and set methods to access and alter their private attributes.

Write the get method getItemName and set method setItemName for class GardenItem. The set method takes the new value as a parameter.

Do not write any other methods, or re-declare the class.

[4]
Reveal mark scheme Mark scheme for question 7(b)(iv)
(b)(v)
Figure for question 7
[6]
Reveal mark scheme Mark scheme for question 7(b)(v)
(c)

* The programmer is designing the program to make use of caching and re-useable components.

Explain and evaluate the use of caching and re-useable components in the design of the garden program.

[9]
Reveal mark scheme Mark scheme for question 7(c)

Algorithms and programming June 2018, Question 1 13 marks

A program stores entered data in a binary search tree.

The current contents of the tree are shown:

Figure for question 1
(a)

Complete the diagram to show the contents of the tree after the following data is added:

England, Scotland, Wales, Australia

[3]
Reveal mark scheme Mark scheme for question 1(a)
(b)

Show the order of the nodes visited in a breadth first traversal on the following tree.

Figure for question 1
[3]
Reveal mark scheme Mark scheme for question 1(b)
(c)

A pseudocode algorithm is written to search the tree to determine if the data item “Sweden” is in the tree.

The function currentNode.left()returns the node positioned to the left of currentNode

Figure for question 1
(c)(i)

Complete the algorithm.

[5]
Reveal mark scheme Mark scheme for question 1(c)(i)
(c)(ii)

The algorithm needs to be used in different scenarios, with a range of different trees.

Identify two preconditions needed of a tree for this algorithm to work.

[2]
Reveal mark scheme Mark scheme for question 1(c)(ii)

Algorithms and programming June 2018, Question 2 12 marks

A company merger is joining five e-commerce retailers under one company, OCRRetail. Each retailer has a different sales system and OCRRetail wants to develop one computer system that can be used by all the retailers.

Mary’s software development company has been employed to analyse and design a solution for the company.

(a)
(a)(i)

Two computational methods (techniques used to solve a problem using computational thinking) that Mary will use are problem recognition and decomposition.

State what is meant by problem recognition and decomposition.

Question 2, shown as an image
Question 2, shown as an image
[2]
Reveal mark scheme Mark scheme for question 2(a)(i)
(a)(ii)

State one additional computational method.

Figure for question 2
[1]
Reveal mark scheme Mark scheme for question 2(a)(ii)
(b)

Mary plans to use data mining to generate information about OCRRetail’s customers. Mary will use this information to benefit the company.

(b)(i)

Define the term ‘data mining’.

Figure for question 2
[1]
Reveal mark scheme Mark scheme for question 2(b)(i)
(b)(ii)

Identify two pieces of information that data mining could provide OCRRetail about sales, and state how OCRRetail could make use of this information.

Question 2, shown as an image

maths symbol

[4]
Reveal mark scheme Mark scheme for question 2(b)(ii)
(c)

Mary has developed the program and is considering using performance modelling before installing the system.

(c)(i)

Define the term ‘performance modelling’.

Figure for question 2
[1]
Reveal mark scheme Mark scheme for question 2(c)(i)
(c)(ii)

Identify one way performance modelling could be used to test the new system.

Figure for question 2
[1]
Reveal mark scheme Mark scheme for question 2(c)(ii)
(d)

Mary created the program as a series of sub-programs that can be reused.

Describe one benefit of Mary creating reusable program components.

Figure for question 2
[2]
Reveal mark scheme Mark scheme for question 2(d)

Report a problem with a question on this page
What is wrong?

Goes to whoever maintains the question split. No account needed and nothing is published on this page.

Memes

Certified Computer Science memes. Peer-reviewed by nobody.

Laugh now. Cry in the exam hall later. Then come back and do a past paper.

Write a proper algorithm
Write ‘sort it’ and leave
Me on the 6-mark pseudocode question
Debugging with print statements
Using a trace table
Knowing the difference between = and ==
Explaining recursion by explaining recursion
Code enlightenment, ranked

Mum 💖

can you fix the wifi since you do computers 🥰

that's not what computer science is

so that's a no then

📱 Screen time this week · Discord8h 2m

Turned it off and on again

Computer Science starter pack

Laptop with 47 tabs openPython error on line 1Counting binary on fingersThis website
Compiled with zero errors