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 procedurally

OCR A Level Computer Science

Topic questions Algorithms Thinking procedurally

Thinking procedurally

8 questions · 165 marks · about 3 hours

Thinking procedurally questions

OCR H446 Thinking procedurally 8 questions

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 8 5 marks

A program is being designed that will allow a user to log into an account on a website using a username and password.

(a)

Identify two possible inputs and one output this program will need.

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

Identify two possible sub-procedures that could be used in this program.

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

Algorithms and programming June 2022, Question 6 9 marks

Also involves Arrays

A card game uses a set of 52 standard playing cards. There are four suits; hearts, diamonds, clubs and spades. Each suit has a card with a number from; 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13.

The card game randomly gives 2 players 7 cards each. The unallocated cards become known as the deck.

The players then take it in turns to turn over a card. A valid move is a card of the same suit or the same number as the last card played.

The winner is the first player to play all of their cards.

(a)

One component of the game is checking if a move is valid.

Identify three other components of the game.

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

A function, checkValid(), takes the card the player has selected, and the last card played as parameters.

It returns true if the player’s move is valid and returns false if the player’s move is not valid.

(b)(i)

State the reason why checkValid() is a function and not a procedure.

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

The programmer will use a branching (selection) construct to make decisions.

Describe the decisions that will be made in the checkValid() function and how these change the return values.

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

The cards are held in the 2D array cards. The first index stores the card number and the second index stores the suit, both as strings.

Write a pseudocode statement or program code to declare the array cards.

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

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 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 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 2017, Question 3 19 marks

Also involves String manipulation · File handling

An encryption routine reads a line of text from a file, reverses the order of the characters in the string and subtracts 10 from the ASCII value of each letter, then saves the new string into the same file.

The program is split into sub-procedures. Three sub-procedures are described as follows:

• Read string from file

• Push each character of the string onto a stack

• Read and encrypt each character message

(a)(i)

Identify one further sub-procedure that could be used in the program.

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

Describe two advantages of splitting the problem into sub-procedures.

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

A function, readMessage:

• takes the file name as a parameter

• reads and returns the line of text

Complete the pseudocode algorithm for readMessage:

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

A function, push, can be used to add a character to a stack. For example:

theStack.push("H")

places the character H onto the stack, theStack.

A procedure, pushToStack, takes a string as a parameter and pushes each character of the message onto the stack, messageStack.

Complete the procedure below.

Add comments to explain how your code works.

procedure pushToStack(message)

endprocedure

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

Describe the steps that the program would have to take in order to encrypt the characters stored in the stack, and save them in a single variable.

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

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