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. Computational methods

OCR A Level Computer Science

Topic questions Algorithms Computational methods

Computational methods

23 questions · 423 marks · about 7.5 hours

Computational methods questions

OCR H446 Computational methods 23 questions

Algorithms and programming June 2025, Question 1 22 marks

Data in a computer program needs to be sorted.

(a)
(a)(i)

Describe the steps a bubble sort will take to sort items into ascending order.

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

Darcie and Felix have both written a program that will perform a bubble sort to put these numbers into ascending order.

Figure for question 1

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]
Reveal mark scheme Mark scheme for question 1(a)(ii)
(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.

Figure for question 1
[5]
Reveal mark scheme Mark scheme for question 1(b)
(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.

Figure for question 1
(c)(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]
Reveal mark scheme Mark scheme for question 1(c)(i)
(c)(ii)

Identify the type of iteration used in the function partition().

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

Describe the role of the function partition() in the quick sort algorithm.

[3]
Reveal mark scheme Mark scheme for question 1(c)(iii)
(c)(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.

Amended line of code........

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

The quick sort is an example of a divide-and-conquer algorithm.

Describe what divide-and-conquer means.

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

Algorithms and programming June 2025, Question 2 14 marks

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 algorithmWorst-case timeAverage-case timeWorst-case space
LinearO(n)O(n)O(1)
BinaryO(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]
Reveal mark scheme Mark scheme for question 2(a)
(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.

(b)(i)

Describe what data mining means.

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

Explain how the company can make use of data mining to improve their website and customer experience.

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

Algorithms and programming June 2025, Question 5 11 marks

Also involves Graphs (data structure)

Figure for question 5
(a)

Explain why this graph is a visualisation of the problem.

[2]
Reveal mark scheme Mark scheme for question 5(a)
(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.

Figure for question 5
[7]
Reveal mark scheme Mark scheme for question 5(b)
(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]
Reveal mark scheme Mark scheme for question 5(c)

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 2024, Question 2 12 marks

2* A company runs a Virtual Learning Environment (VLE). Schools can register students to use the VLE. The students get their own account and the school can view and monitor their students who are registered. There are currently over 10 000 schools registered, each with up to 1000 students.

The students can watch videos, take quizzes and communicate using forums and online chat tools.

The company gathers a large amount of data and wants to use data mining to help them decide how to improve the VLE in the future.

Discuss how the company can use data mining to decide how to improve the VLE.

You should include the following in your answer:

• the characteristics of data mining

• the benefits of data mining in this scenario

• the drawbacks of data mining in this scenario.

[12]
Reveal mark scheme Mark scheme for question 2

Algorithms and programming June 2024, Question 3 20 marks

Also involves Trees and binary search trees · Graphs (data structure)

A computer game has a building containing 7 rooms. There are secret passages between each room. Fig. 3 shows the rooms and the passages between the rooms represented as a graph data structure.

Figure for question 3
(a)

The number in bold below each node in Fig. 3 is the heuristic value.

Perform an A* algorithm on the graph shown in Fig. 3 to find the shortest path from A to G.

Show your working, the nodes visited and the distance.

You may use the table below to give your answer.

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

State four ways that a graph data structure is different from a tree data structure.

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

* The final game will involve multiple computer-controlled characters and interactive elements that make use of artificial intelligence to determine the moves they will make.

The artificial intelligence will use heuristics to determine where the computer-controlled characters will move in the game.

Discuss how heuristics can be used in algorithms.

You should include the following in your answer:

• the purpose of heuristics

• the benefits and drawbacks of heuristics

• the suitability of heuristics in algorithms within a computer game.

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

Algorithms and programming June 2024, Question 8 13 marks

A group of students are designing a racing car game. The game will allow players to enter their name and then a choice of vehicle. They will then race against other vehicles that will be controlled by the program. Players will use the arrow keys to control their vehicle.

(a)

The students are identifying the inputs and outputs for the game.

Complete the table by identifying two inputs and two outputs for the game.

Input 1........................................................................................................................ ........................................................................................................................
Input 2........................................................................................................................ ........................................................................................................................
Output 1........................................................................................................................ ........................................................................................................................
Output 2........................................................................................................................ ........................................................................................................................
[4]
Reveal mark scheme Mark scheme for question 8(a)
(b)

The students use abstraction during the design process.

(b)(i)

State what is meant by abstraction and describe how it can be used to design the racing car game.

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

Explain why it is beneficial to use abstraction when designing a computer program such as a game.

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

The group of students also use decomposition.

State what is meant by decomposition.

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

Describe one benefit of using decomposition when designing a computer program such as a game.

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

Algorithms and programming June 2023, Question 2 9 marks

2* A company needs a new computer program that will create schedules for delivery drivers. It will need to identify a possible order that the drivers can deliver items and possible routes they could take.

Discuss how programmers could make use of problem recognition and problem decomposition when designing this system.

You should include the following in your answer:

• a description of both problem recognition and decomposition

• how each method can be used when designing the solution

• the benefits of using each method when designing the solution.

[9]
Reveal mark scheme Mark scheme for question 2

Algorithms and programming June 2022, Question 4 9 marks

A programmer is developing an aeroplane simulator. The user will sit in a cockpit and the simulated environment will be displayed on screens around them.

(a)

The programmer uses computational methods to design a solution for the program.

(a)(i)

Complete the table by writing a definition for each computational method.

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

Give three potential differences between the abstracted aeroplane simulator and reality.

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

Identify two reasons why abstraction is used when designing a solution to the problem.

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

Describe how caching can be used in the aeroplane simulator.

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

Algorithms and programming June 2022, Question 5 14 marks

Also involves Graphs (data structure)

Figure for question 5
(a)(i)

State one way a directed graph is different to an undirected graph.

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

State one way a graph data structure is different to a tree data structure.

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

Give one reason why the graph is a visualisation of the problem.

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

Give a similarity and difference between the performance of Dijkstra’s algorithm and the performance of A* algorithm.

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

State why performance modelling is used to test a system.

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

Describe how performance modelling can be used in the delivery system.

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

Algorithms and programming November 2021, Question 1 33 marks

Taylor is creating an online multiplayer game where users can create accounts and build their own circus. Each circus will contain characters such as clowns, animals, magicians and dancers.

Users can set up a new circus in the online world, purchase new characters and visit other users’ circuses.

(a)

Taylor uses computational methods to analyse the problem including abstraction.

Describe how Taylor could use abstraction in the design of his online circus game.

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

Taylor will make use of concurrent processing within his circus game.

(b)(i)

Describe what is meant by the term ‘concurrent processing’.

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

Explain why concurrent processing is needed to allow multiple users to log in and interact with game elements at the same time.

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

Some of the characters in the game will move and interact independently. Taylor is going to use graphs to plan the movements that each character can take within the game.

DancerGold is one character. The graph shown in Fig. 1 shows the possible movements that DancerGold can make.

Figure for question 1

DancerGold’s starting state is represented by node A. DancerGold can take any of the paths to reach the end state represented by node G.

The number on each path represents the number of seconds each movement takes.

The number in bold below each node is the heuristic value from A.

(c)(i)

Define the term heuristic in relation to the A* algorithm.

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

Perform an A* algorithm on the graph shown in Fig. 1 to find the shortest path from the starting node to the end node. Show your working, the nodes visited and the distance. You may choose to use the table below to give your answer.

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

A breadth-first traversal can be performed on both a tree and a graph.

Show how a breadth-first traversal is performed on the following binary tree.

Figure for question 1
[6]
Reveal mark scheme Mark scheme for question 1(d)
(e)

* The game will have thousands of users. Taylor will store data about the users and their actions while playing the game in a large database.

Evaluate how Taylor can use data mining to inform future changes to improve his circus game.

[9]
Reveal mark scheme Mark scheme for question 1(e)

Algorithms and programming November 2021, Question 3 7 marks

(a)

A one dimensional array holds data that needs to be sorted.

Describe how a quicksort would sort data into ascending order.

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

Explain why a quicksort is known as a divide and conquer algorithm.

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

Algorithms and programming November 2021, Question 6 6 marks

Also involves The fetch-execute cycle · CPU performance

Amy’s processor makes use of pipelining during the fetch-decode-execute cycle.

(a)

The processor’s pipeline consists of the following stages:

• Fetching the instruction from memory

• Decoding the instruction

• Executing the instruction.

Instructions A, B, C and D need to be processed.

Identify the stage(s) and instruction(s) run during each pipeline below.

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

Explain why pipelining can improve the performance of the processor.

[2]
Reveal mark scheme Mark scheme for question 6(b)

Algorithms and programming November 2021, Question 8 40 marks

Also involves Syntax and logic errors · Arrays

Figure for question 8
(a)

Juan is creating a structure diagram to design the game.

(a)(i)
Figure for question 8
[3]
Reveal mark scheme Mark scheme for question 8(a)(i)
(a)(ii)

A structure diagram is one method of showing the decomposition of a problem.

Explain why decomposing a problem can help a developer design a solution.

[2]
Reveal mark scheme Mark scheme for question 8(a)(ii)
(a)(iii)

Identify one input, one process and one output required for the game.

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

Juan uses the structure diagram to create a modular program with a number of subroutines. The program will use two integer 2-dimensional arrays to store the puzzles:

• puzzle(5,5) stores the solution

• answerGrid(5,5) stores the user’s current grid.

A 0 represents a white box and a 1 represents a black box.

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

Explain the purpose of line 03 in the function countRow.

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

Describe the purpose of branching and iteration in the function countRow.

[3]
Reveal mark scheme Mark scheme for question 8(b)(iii)
(b)(iv)
Figure for question 8
[6]
Reveal mark scheme Mark scheme for question 8(b)(iv)
(b)(v)

The function checkWon() takes answerGrid and puzzle as parameters and compares each element in the grids. If they are identical, it returns true, otherwise returns false.

Figure for question 8

There are three logic errors in the function checkWon.

State the line number of each error and give the corrected line.

Error 1 line number........

Error 1 correction........

Error 2 line number........

Error 2 correction........

Error 3 line number........

Error 3 correction........

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

* Juan passed the two arrays as parameters, but he did consider making them globally accessible.

Compare the use of global and local variables and data structures in this program. Include the use of parameters and program efficiency in your answer.

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

Juan wants to create a program that will generate new Nonograms with different grid sizes. For example a Nonogram with a 10 × 10 grid or a 5 × 20 grid.

Describe how the program could be written to automatically generate a new Nonogram.

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

Algorithms and programming November 2020, Question 2 13 marks

OCR-Tickets wants to sell tickets for their concerts, plays and other events online. A customer should be able to create an account and then be able to log into their account. Once logged in, customers should be able to carry out actions such as setting their preferences and purchase tickets.

OCR-Tickets have hired a software development company to create the system for them.

(a)

The system requirements have a number of features that mean they are solvable by computational methods, such as decomposition.

Explain why decomposition can help the development of the program.

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

* Discuss the need for concurrent processing in OCR-Ticket’s system and the benefits and drawbacks of using this.

[9]
Reveal mark scheme Mark scheme for question 2(b)

Algorithms and programming June 2019, Question 2 22 marks

Also involves Trees and binary search trees

A program needs to store the names of plants that are in a garden, so they can be easily found and accessed in alphabetical order.

The data is stored in a tree structure. Part of the tree is shown.

Figure for question 2
(a)
(a)(i)

State the type of tree shown in Fig. 2.1.

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

Show the output of a breadth-first traversal of the tree shown in Fig. 2.1.

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

Explain how backtracking is used in a depth-first (post-order) traversal. Use the tree in Fig. 2.1 in your explanation.

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

The elements in the tree in Fig. 2.1 are read into a linked list producing an alphabetised list.

(b)(i)

Complete the following table to show the linked list for the data.

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

A new plant, Lavender, needs adding to the linked list. The linked list needs to retain its alphabetical order.

Complete the table to show the linked list after Lavender is added.

Figure for question 2
[3]
Reveal mark scheme Mark scheme for question 2(b)(ii)
(b)(iii)

Hosta needs removing from the linked list.

Explain how a data item is removed from a linked list. Use the removal of Hosta in your answer.

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

The linked list is stored as a 2D array with the identifier plantList. The index of the first element of the linked list is stored in the identifier firstElement.

All contents of the linked list need to be output in alphabetical order.

Write an algorithm to follow the pointers to output the contents of the linked list in alphabetical order.

Add comments to explain your code.

[5]
Reveal mark scheme Mark scheme for question 2(b)(iv)

Algorithms and programming June 2019, Question 4 27 marks

Mabel is a software engineer. She is writing a computer game for a client. In the game the main character has to avoid their enemies. This becomes more difficult as the levels of the game increase.

(a)

Mabel uses decomposition to design the program.

Explain how decomposition can aid the design of this program.

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

The computer game allows a user to select a character (e.g. name, gender). They can then choose a level for the game (easy, normal, challenging). The user controls their character by moving it left or right. The character can jump using space bar as an input. If the character touches one of the enemies then it loses a life. The character has to make it to the end of the level without losing all their lives.

The game is designed in a modular way.

(b)(i)

One sub-procedure will handle the user input.

Describe three other sub-procedures Mabel could create for the given game description.

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

Describe the decision that the program will need to make within the user input sub- procedure and the result of this decision.

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

Define pipelining and give an example of how it could be applied in the program.

[2]
Reveal mark scheme Mark scheme for question 4(b)(iii)
(c)
Figure for question 4
[6]
Reveal mark scheme Mark scheme for question 4(c)
(d)

*Mabel has been told that true programmers write programs in a text editor, and do not use IDEs. Mabel does not agree with this statement.

Discuss the use of an IDE in the development of this program.

[9]
Reveal mark scheme Mark scheme for question 4(d)

Algorithms and programming June 2019, Question 6 9 marks

6* Benedict runs a social networking website. He has been told he should use data mining to help him enhance and improve his website.

Evaluate the use of data mining to help Benedict enhance and improve his social networking website.

[9]
Reveal mark scheme Mark scheme for question 6

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)

Algorithms and programming June 2018, Question 3 27 marks

Also involves Trees and binary search trees · Graphs (data structure)

Figure for question 3
(a)

The graph in Fig. 3 is a visualisation of the problem.

(a)(i)

Identify one difference between a graph and a tree.

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

Explain how the graph is an abstraction of the problem.

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

Identify two advantages of using a visualisation such as the one shown in Fig. 3.

Question 3, shown as an image
Question 3, shown as an image
[2]
Reveal mark scheme Mark scheme for question 3(a)(iii)
(b)

Demonstrate how Dijkstra’s algorithm would find the shortest path to the solution in Fig. 3.

Figure for question 3

maths symbol

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

* The creator of the puzzle has been told that the A* algorithm is more efficient at finding the shortest path because it uses heuristics.

Compare the performance of Dijkstra’s algorithm and the A* search algorithm, making reference to heuristics, to find the shortest path to the problem.

Figure for question 3

maths symbol

[9]
Reveal mark scheme Mark scheme for question 3(c)
(d)
Figure for question 3 Figure for question 3 Figure for question 3
[6]
Reveal mark scheme Mark scheme for question 3(d)

Algorithms and programming June 2017, Question 4 14 marks

Also involves Trees and binary search trees

Figure for question 4
(a)

Identify the data structure shown in Fig. 4.1.

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

The programmer is considering using a depth-first (post-order) traversal, or a breadth-first traversal to find the path between node A and node X.

(b)(i)

Explain the difference between a depth-first (post-order) and breadth-first traversal.

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

Show how a depth-first (post-order) traversal would find the path between node A and node X for the structure shown in Fig. 4.1.

[6]
Reveal mark scheme Mark scheme for question 4(b)(ii)
(b)(iii)

Explain how you used backtracking in your answer to part (b)(ii).

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

Algorithms and programming June 2017, Question 6 40 marks

A software developer is creating a Virtual Pet game.

The user can choose the type of animal they would like as their pet, give it a name and then they are responsible for caring for that animal. The user will need to feed, play with, and educate their pet.

The aim is to keep the animal alive and happy, for example if the animal is not fed over a set period of time then the pet will die.

• The game tells the user how hungry or bored the animal is as a percentage (%) and the animal’s intelligence is ranked as a number between 0 and 150 (inclusive).

• Hunger and boredom increase by 1% with every tick of a timer.

• When the feed option is selected, hunger is reduced to 0.

• When the play option is selected, bored is reduced to 0.

• When the read option is selected, the intelligence is increased by 0.6% of its current value.

An example of the game is shown:

Figure for question 6

Fig. 1.1

(a)

Identify three inputs that the user will have to enter to start, and/or play the game.

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

The developer is using decomposition to design the game.

(b)(i)

Describe the process of decomposition.

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

The developer needs to write procedures for the options play and read. Each of the options changes its corresponding value, and outputs the results to the screen.

(c)(i)

Write a procedure, using pseudocode, to reset bored and output the new value in an appropriate message.

[3]
Reveal mark scheme Mark scheme for question 6(c)(i)
(c)(ii)

Write a procedure, using pseudocode, to increase intelligence by 0.6% and output the new intelligence in an appropriate message.

[3]
Reveal mark scheme Mark scheme for question 6(c)(ii)
(d)

The developer is extending the game to allow users to have multiple pets of different types. The developer has written a class, Pet.

The attributes and methods in the class are described in the table:

Figure for question 6

Part of the class declaration is given:

Figure for question 6
(d)(i)
Figure for question 6
[4]
Reveal mark scheme Mark scheme for question 6(d)(i)
(d)(ii)

Write a line of code that creates a new instance of Pet for a Tiger called “Springy”.

[2]
Reveal mark scheme Mark scheme for question 6(d)(ii)
(d)(iii)

The method outputGreeting for the superclass is written as follows:

Figure for question 6

A class is needed for Tiger. The class needs to:

• inherit the methods and attributes from pet

• in the constructor, set type to Tiger, intelligence to 10, hunger to 50 and bored to 10

• extend the method outputGreeting, by outputting an additional line that says “I like to eat meat and roar”

Write, using pseudocode, the class Tiger.

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

(e*) The developer made use of abstraction when creating the Virtual Pet game.

Discuss the need for and purpose of abstraction and how abstraction will be used in the

development of the game.

[9]
Reveal mark scheme Mark scheme for question 6(e)
(f)

The developer is storing the user’s pets in a 1-dimensional array. At each timer interval, the array is searched, using a linear search, to check if any pets’ hunger or bored values are greater than 90%. If they are, an alert is displayed to the user.

(f)(i)

State the complexity of searching the pets in Big-O notation.

[1]
Reveal mark scheme Mark scheme for question 6(f)(i)
(f)(ii)

A given computer takes 4 milliseconds (ms) to search an array of 20 pets. Calculate an estimate of how long the computer will take to search an array of 100 pets.

Show your working.

[2]
Reveal mark scheme Mark scheme for question 6(f)(ii)

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