0% found this document useful (0 votes)
106 views

Algorithm Exam Questions

This document contains exam questions related to algorithms. The first question asks to create usernames from first and last names using different processes. The second question asks to write an algorithm to estimate the time needed to complete a worksheet based on number and difficulty of questions. The third question explains an algorithm to guess football goals and asks about constants, variables, and outputs given inputs.

Uploaded by

Produktemeulje
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
106 views

Algorithm Exam Questions

This document contains exam questions related to algorithms. The first question asks to create usernames from first and last names using different processes. The second question asks to write an algorithm to estimate the time needed to complete a worksheet based on number and difficulty of questions. The third question explains an algorithm to guess football goals and asks about constants, variables, and outputs given inputs.

Uploaded by

Produktemeulje
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Surname:

Other Names:

ALGORITHM EXAM
QUESTIONS

Paper out of 63 Marks.
1. Mariama needs to automatically create usernames from people's first names and surnames. She creates a flowchart in order
to do this, which is shown below.

For example, Dan Priestley's username would be PriestleyDa.
a) Using the process above, state the username for Graham Dodds.

....................................
(1)
b) Mariama chooses to alter the process so it does the following: 

If the person is 18 or over, their username is their first name followed by the first letter of their surname
If the person is under 18, their username is their surname followed by the first letter of their first name

i) What would be the username of a thirty year old called Chris Watson using the updated process?

....................................
(1)
ii) Write an algorithm that Mariama could use to create a username using the updated process

.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
(6)
(Total 8 Marks)
Level: 8

createatest.co.uk Page 1 of 8
2. A Maths teacher wants to estimate how long it should take her students to complete a worksheet. You are required to
develop an algorithm to calculate this estimate. The algorithm must do the following:

 ask the teacher how many questions the worksheet contains and store this in an appropriately named variable
 for every question in the worksheet the algorithm should:
ask the teacher if the question looks 'easy' or 'difficult'
if a question is 'difficult' then the total number of seconds should increase by 2
if a question is 'easy' then the total number of seconds should increase by 1
 after the teacher has entered the difficulty level for all the questions, the algorithm should output the estimated
number of seconds that it should take to complete the worksheet.

Write pseudocode or draw a flowchart that represents this algorithm.

(9)
(Total 9 Marks)
Level: 8

createatest.co.uk Page 2 of 8
3. Santos is writing a program that guesses the number of goals a team will score in a football match.
The algorithm for his program is shown below:

a) State what is meant by a constant and give an example from the algorithm above

.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
(2)
b) State what is meant by a variable and give an example from the algorithm above
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
(2)
c) State the number of goals that will be output by this algorithm for the following inputs.
Explain how you obtained your answer in each case.
i) Wins = 30     Losses = 25

.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
(2)
ii) Wins = 20     Losses = 5

.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
(3)
(Total 9 Marks)
Level: 7

createatest.co.uk Page 3 of 8
4. Write an algorithm for a computer program that does the following:

The user inputs three numbers as x1, x2 and x3
If two (or three) of the numbers are the same, the program outputs "Pair"
Otherwise, the program outputs "No pair"

.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
(5)
(Total 5 Marks)
Level: 7
5. Frankie and Andre are playing a game. They each roll a dice seven times. The winner is the person who gets the highest
total.
The results of Frankie's rolls are stored in an array: frankie_rolls
The results of Andre's rolls are stored in an array: andre_rolls
What a pseudocode algorithm that does the following:

Adds together all of Frankie's rolls
Adds together all of Andre's rolls
Compares the totals and outputs the name of the winner, or if its a draw

Make sure your algorithm is efficient, and leave comments explaining your code

(7)
(Total 7 Marks)
Level: 7

createatest.co.uk Page 4 of 8
6. A woman buys a car from a used car storeroom. The value of the car reduces by 10% every year. The woman decides that
when the value of the car is less than £1000, she will sell it.
Write a psuedocode algorithm that:

takes as input the initial value of the car
calculates the number of years until the woman will sell the car
outputs the number of years

.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
(5)
(Total 5 Marks)
Level: 6

createatest.co.uk Page 5 of 8
7. The code below defines a function 'MultiSub'.

a) Explain why 'MultiSub' is a function, rather than a procedure

.........................................................................................................................................................................
.........................................................................................................................................................................
(1)
b) Complete the trace table below for when the subroutine MultiSub(2,3) is called.
x y z
     
     
     
     
     
 
(3)
c) Aprogrammer decides to improve the code by simplifying it. He replaces the following lines:

with the following:

Explain why this is a mistake

.........................................................................................................................................................................
.........................................................................................................................................................................
(2)
d) What value is returned by the function MultiSub(a,0) where a is any number?

....................................
(1)
(Total 7 Marks)
Level: 6

createatest.co.uk Page 6 of 8
8. A programmer is creating a 3D simulation of a school for a new computer game.
The programmer is using the computational skills of abstraction and decomposition to create their design.
a)
i) Describe what is meant by 'abstraction'

.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
(2)
ii) Give one example of how the programmer could use abstraction when creating the simulation

.........................................................................................................................................................................
.........................................................................................................................................................................
(1)
b) Define the term 'decomposition'
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
(2)
d) Identify one additional computational thinking skil that the programmer will use when creating the simulation
.........................................................................................................................................................................
(1)
(Total 6 Marks)
Level: 5
9. A list is made up of the numbers 72, 56, 5, 32, 21, 12, 64, 1
Show the steps involved when sorting this list of numbers using the merge sort algorithm

(2)
(Total 2 Marks)
Level: 5
10. Sofia has been asked to write a computer program that puts a series of strings in order of length, starting with the smallest.
Explain why the computational thinking skill of algorithmic thinking is important, and explain how Sofia can apply it to this
problem.

.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
(3)
(Total 3 Marks)
Level: 5

createatest.co.uk Page 7 of 8
11. Krish is writing a computer program. She is going to write it in psuedocode first.
Why would Krish choose to write in pseudocode before writing in a formal programming language?

.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
.........................................................................................................................................................................
(2)
(Total 2 Marks)
Level: 5

createatest.co.uk Page 8 of 8

You might also like