← Back to Dashboard

2.1 Algorithms

GCSE Computer Science (J277)

1. State the name of each of the following computational thinking techniques
a) Breaking a complex problem down into smaller problems.
[1]
Login to save your answers
/ 1
b) Hiding or removing irrelevant details from a problem to reduce the complexity.
[1]
Login to save your answers
/ 1
2. A fast food restaurant offers half-price meals if the customer is a student or has a discount card.
The offer is not valid on Saturdays.
A computer system is used to identify whether the customer can have a half-price meal.
The table identifies the three inputs to the computer system:
Question Image
a) The restaurant needs an algorithm designing to help employees work out if a customer can
have a half price meal or not. It should:
β€’ input required data
β€’ decide if the customer is entitled to a discount
β€’ output the result of the calculation.
Design the algorithm using a flowchart
[5]
Login to save your answers
/ 5
b) The restaurant adds a service charge to the cost of a meal depending on the number of
people at a table. If there are more than five people 5% is added to the total cost of each
meal.
Customers can also choose to leave a tip, this is optional and the customer can choose
between a percentage of the cost, or a set amount. Identify all the additional inputs that will be required for this change to the algorithm.
[2]
Login to save your answers
/ 2
3. A program stores the following list of positive and negative numbers. The numbers need sorting into ascending order using a merge sort.
The first step is to divide the list into individual lists of one number each. This has been done
for you.
Demonstrate the merging stage of a merge sort by showing each step of the process.
[3]
Question Image
Login to save your answers
/ 3
4. Once the numbers are in order, a binary search can be run on the data.
Describe the steps a binary search will follow to look for a number in a sorted list
[4]
Login to save your answers
/ 4
5. A linear search could be used instead of a binary search. Describe the steps a linear search would follow when searching for a number that is not in the given list.
[3]
Login to save your answers
/ 3
6. Jack decides to improve his program. He wants to be able to input how many numbers to add together each time the algorithm runs, and also wants it to calculate and display the average of these numbers.

Write an algorithm to:
β€’ ask the user to input the quantity of numbers they want to enter and read this value as input
β€’ repeatedly take a number as input, until the quantity of numbers the user input has been entered
β€’ calculate and output the total of these numbers
β€’ calculate and output the average of these numbers
[6]
Login to save your answers
/ 6
7. Each member of staff that works in the restaurant is given a Staff ID. This is calculated using the following algorithm.
[4]
Question Image
line num surname year staffID Output
01 Kofi
02 2021
/ 4
Please login to save your answers and marks.