40 Algorithm Challenges Booklet
40 Algorithm Challenges Booklet
40 Algorithm Challenges Booklet
This booklet has been created to help students become familiar with creating flowcharts, and using
pseudocode or OCR Reference Language.
Reference may be made to the OCR Reference Language guide at the back of the GCSE (9-1)
Computer Science specification when creating more formally written answers.
Students may wish to write in the programming language that they use within the classroom.
Guidance on assessment of answers may be found in our Sample Assessment Materials for
Component 02, and within the Assessment Story document.
It should be noted that there may be different ways to solve each challenge. Credit should be
given for a solution where it meets the requirements and is technically correct.
As good practice, we suggest allowing time for students to discuss different solutions. They should
reflect on different ideas and techniques, looking at how other students have used them. This
provides good exposure to alternate solution/problem solving and builds confidence in techniques.
Whilst the challenges are graded from 1 to 10 in difficulty, these are approximate, and are
suggested only. The grading in difficulty does not necessarily reflect the GCSE 9-1 grading system.
A list of relevant techniques that students may need to understand to solve these challenges may
be found in the current GCSE (9-1) Computer Science specification. This is available to download
from the J277 Web page.
Contents
Difficulty 1 Challenges........................................................................................................................... 4
Challenge 1........................................................................................................................................ 4
Challenge 2........................................................................................................................................ 4
Challenge 3........................................................................................................................................ 4
Challenge 4........................................................................................................................................ 4
Difficulty 2 Challenges........................................................................................................................... 5
Challenge 5:....................................................................................................................................... 5
Challenge 6........................................................................................................................................ 5
Challenge 7:....................................................................................................................................... 5
Difficulty 3 Challenges........................................................................................................................... 6
Challenge 8........................................................................................................................................ 6
Difficulty 4 Challenges........................................................................................................................... 6
Challenge 9........................................................................................................................................ 6
Challenge 10...................................................................................................................................... 6
Challenge 11...................................................................................................................................... 7
Challenge 12...................................................................................................................................... 7
Challenge 13:..................................................................................................................................... 7
Difficulty 5 Challenges........................................................................................................................... 8
Challenge 14...................................................................................................................................... 8
Challenge 15...................................................................................................................................... 8
Challenge 16...................................................................................................................................... 8
Challenge 17...................................................................................................................................... 9
Challenge 18...................................................................................................................................... 9
Challenge 19...................................................................................................................................... 9
Pseudocode only challenges............................................................................................................... 10
Challenge 20.................................................................................................................................... 10
Challenge 21:................................................................................................................................... 10
Challenge 22.................................................................................................................................... 10
Challenge 23.................................................................................................................................... 11
No help given, pseudocode only!......................................................................................................... 12
Challenge 24.................................................................................................................................... 12
Challenge 25.................................................................................................................................... 12
Challenge 26.................................................................................................................................... 12
Challenge 27.................................................................................................................................... 13
Challenge 1
Design a program which asks the
Challenge 2
The program asks the user to input their first name. The program then outputs the users first
name.
Challenge 3
The program asks the user to input their surname and then their first name. The program then
outputs the user’s first name and then their surname separately.
Challenge 4
The program asks the user to input their first name and then their surname. The program then
outputs the user’s first name and then their surname on the same line.
Challenge 5
The program asks the user to input two numbers. The program adds them together and then
outputs the total.
Challenge 6
The program asks the user to input two numbers. The program will then output:
Challenge 8
The program asks the user to input how many minutes and texts they have used in the last month
and then outputs the total cost of the bill. This is calculated by working out:
The total cost of the minutes (at £0.10 per minute) and….
Adding this to the total cost of the texts (at £0.05 per text) and….
Adding on an additional monthly charge of £10.00.
Challenge 9
Write an algorithm that:
Challenge 10
The program asks the user to input the number of letters in the alphabet. The program must then
output whether they got it correct or incorrect.
Challenge 11
The program asks the user to input two numbers. It will then output the larger of these two
numbers.
Challenge 12
Write an algorithm that:
Challenge 13
A company calculates holiday allowance for employees.
The company gives each employees 28 days holiday each year. Holidays are awarded based on
the following rules:
1. Full time employees who work 5 days a week get 28 days holiday a year
2. Part time employees get a proportion of holiday allowance based on how many days they
work, e.g. An employee who works 1 day a week would only get 1/5th of the holidays
allowed.
Challenge 14
Write an algorithm that:
Challenge 15
Write a program that:
Asks the user to name one of the Olympic Values (Respect, Excellence and Friendship)
If they correctly name one, output 'That’s correct‘
Otherwise outputs ‘Incorrect’
Asks the user how long on average they spend watching TV each day.
If it is less than 2 hours, outputs ‘That should be ok’
If it is between 2 and 4 hours, outputs ‘That will rot your brain’
Otherwise outputs “That is too much TV”
Challenge 17
Write an algorithm that:
• Outputs all numbers between 1 and 10 only.
Challenge 18
Write an algorithm that:
Asks the user to input a number and repeat this until they guess the number 7.
Congratulate the user with a ‘Well Done’ message when they guess correctly.
Challenge 20
MyHotPizza company have developed a new loyalty reward system for customers. Customers are
automatically sent a reward card if they order more than 20 pizzas in a year.
Write an algorithm that goes through the customer orders, and where needed, sends customers a
loyalty card if they do not already have one. If they have not ordered enough pizzas, then it
removes them from the card list.
Challenge 21
A local swimming centre offers the following discounts:
Asks the user to input how many marks they got on a test.
It should then convert this to a grade between 1 to 9 using the table below and then output
the grade to the user. If they have not scored enough to be given a grade than a ‘U’ grade
must be output.
Mark Grade
Greater than or equal to 10 1
Greater than or equal to 20 2
Greater than or equal to 30 3
etc
Challenge 23
Create an algorithm that will:
Allow the user to input how much money they want to change to coins.
Select which coin they want to convert the money into £1, 50p, 20p, 10p, 5p, 2p ,p
Calculate how many of each coin will be given in.
Challenge 25
SpeedyClub Runners is a local sports club, who organise a 5k race every year.
The results of the race are stored in a record structure (called RaceFile) as follows:
Produce an algorithm that counts the number of runners in each Age category for the race.
Challenge 26
A dog that is 5 years old is equivalent to a 42 year old human. Ashok is writing a program which
converts the age of the dog to the equivalent age for a human.
Write an algorithm to calculate and output the human equivalent of the age of the dog using the
method described.
Allow the number of passengers and he distance of the journey to be input as whole
numbers,
Calculate the cost of the journey,
Output the cost that has been calculated.
Challenge 28
A gardener needs to buy some
turf for a project they are working on. The garden is rectangular with a circular flower bed in the
Asks the user for the dimensions of the lawn and the radius of the circle (in metres)
Calculates and output the amount of turf needed
Challenge 29
The wages earned by a worker is either £2 for every teddy bear the have made or £5 for every
hour they have worked, whichever is larger.
allows the user to input the number of teddy bears made and the number of hours worked
calculates the wages for the number of teddy bears made
calculates the wages for the number of hours worked
outputs the larger of the two results.
Challenge 30
An isosceles triangle is a triangle that has at least two equal sides. The diagram below shows
examples of isosceles triangles. In each diagram the marked sides are equal.
Write an algorithm for a computer program that determines whether a triangle in an isosceles
triangle.
The user inputs the lengths of the three sides as Length 1, Length 2 and Length 3
If any two side have the same length the program outputs “Isosceles”
Otherwise the program outputs “Not Isosceles”
The user will provide a series of numbers, representing the weights in grams of individual
fruits.
The weights are always whole positive numbers.
The number of weights to be entered will also be provided by the user.
The solution should calculate and report the mean weight of the fruits to two decimal
places.
How many weights do you want to enter? How many weights do you want to enter?
3 4
Enter a weight: Enter a weight:
138 279
Enter a weight: Enter a weight:
135 135
Enter a weight: Enter a weight:
285 145
Average weight is: 186.00 Enter a weight:
138
Average weight is: 174.25
Challenge 32:
Norma would like to invest her savings in a bank account that generates the most money. She
would like a program that will allow her to:
Challenge 33
Write an algorithm that:
Challenge 34
Roger has switched to a new electric supplier. He will receive free electric one day a week. He will
not pay for the day that he uses the least amount of electric. Write an algorithm that will:
Allow the user to input the day of the week and then unit of units of electric used.
Compare them until all comparisons are completed.
Challenge 35
Write an algorithm that:
Asks the user to input many cars are available for a trip.
Asks the user to input how many people are going on the trip.
If there are enough seats it should output ‘We have enough seats’
If there are not enough seats it calculates how many extra cars are needed and then output
‘Another x cars are needed’ with x being the number of cars.
Challenge 36
Petrol costs £1.40 per litre. Diesel costs £1.55 per litre. LPG costs £0.95 per litre.
Ask the user for which type of fuel their car uses and how much they have put into it.
Calculate the correct price of the fuel they have taken.
Ask how much money they have handed over and calculate the amount of change they are
due.
Finally, ask them if they have a loyalty card and if they do calculate how many points they
should have added to it using the following – 1 point for every litre of fuel they’ve taken plus
1 point for every full pound they’ve paid.
If the number of points they get is more than 100 they get a bonus 10% extra points.
The number of points should then be outputted
Challenge 37
A free drinks machine in an office provides 20 different
drinks.
Challenge 38
The company also offers a saving plan. Customers pay a fixed amount each year into the savings
plan. At the end of each year, the company adds the value of the savings plan at the start of the
year to the amount paid, and then adds interest of 10% to obtain the final value for the year.
For example, if a customer saves £100 each year, the value of the savings plan for 5 years is
shown in the table below.
Write an algorithm which allows the user to input the amount saved each year and the number of
years, and the outputs the growth of the savings plan in the format shown above.
Challenge 39
A primary school teacher wants a computer program to test the basic arithmetic skills of her
students. The program should generate a quiz consisting of a series of random questions, using in
each case any two numbers and addition, subtraction and multiplication. The system should ask
student’s name, then ask 10 questions, output if the answer to each question is correct or not and
produce a final score out of 10.
Scores from the quiz should be stored and added to when a student takes a new quiz.
Challenge Rating 10
Challenge 40
Write an algorithm for a game of your choice that:
Looking for another resource? There is now a quick and easy search tool to help find free resources for your
qualification.