GCSE Computer Science End of TopicTests - Algorithms.199788941
GCSE Computer Science End of TopicTests - Algorithms.199788941
Algorithms
Topic Tests
Photocopiable Resources
Edulito©2017 Page 1
GCSE Computer Science (9-1) Algorithms - Topic Test
You do not have permission to distribute it as a paper or electronic document to other schools
or organisations.
Edulito©2017 Page 2
GCSE Computer Science (9-1) Algorithms - Topic Test
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………
Edulito©2017 Page 3
GCSE Computer Science (9-1) Algorithms - Topic Test
2 (b) This is an example of a binary search. It can be used to search for a particular student
name. Complete the algorithm by adding T for True and F for FALSE to the empty boxes. [6]
Edulito©2017 Page 4
GCSE Computer Science (9-1) Algorithms - Topic Test
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………
2 (d) Using pseudocode or a flow chart, write an algorithm for a linear search in the space
Edulito©2017 Page 5
GCSE Computer Science (9-1) Algorithms - Topic Test
3 There are some gaps in the bubble sort below. Complete the gaps using the words
shown. [6]
4. Move to the ………………………………………. number along in the list and make this the
current number.
5. Repeat from step 2 until the ………………………………………. number in the list has been
reached.
7. If the end of the list is reached without any swaps being made, then the list is
…………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………
(b) Give an advantage and a disadvantage of merge sort over a bubble or insertion sort.
[2]
Advantage…………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………
Disadvantage……………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………
Edulito©2017 Page 6
GCSE Computer Science (9-1) Algorithms - Topic Test
…………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………
(b) Is the insertion sort quicker or slower than the bubble sort? [1]
…………………………………………………………………………………………………………………………………………
6. (a) Use pseudocode to create to produce an algorithm that asks for the length of a
rectangle and the width of a rectangle. The algorithm then calculates the area of the
square and displays a message “the area of the square is” and displays the area of the
square. Include comments to explain what each line of code does. [8]
Edulito©2017 Page 7
GCSE Computer Science (9-1) Algorithms - Topic Test
6(b) Use pseudocode to produce an algorithm that asks the person to enter a number
between 1 and 20. If the number is greater or equal to 10 then display a message “The
number is equal or higher than 10”. However, if the number is less than 10 it should
display the message “The number is less than 10”. [5]
7 (a) Produce a flow chart that shows an algorithm for making a cup of tea. It should include:
Sequence; Selection, Iteration. [5]
Edulito©2017 Page 8
GCSE Computer Science (9-1) Algorithms - Topic Test
7(b) Produce a flow chart that inputs a random number and inputs the number that you
want to guess. The flowchart then compares the number you have guessed with the random
number and if they are the same you get a message to say “Correct”, but if you guess
incorrectly the algorithm uses an indefinite loop to allow the person to keep on guessing
until they get the number right. [5]
7(c) If you wanted to give the person no more than three guesses, what would you need to
add to the flowchart? [3]
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………
Edulito©2017 Page 9
GCSE Computer Science (9-1) Algorithms - Topic Test
Edulito©2017 Page 10
GCSE Computer Science (9-1) Algorithms - Topic Test
2d Algorithm includes: 4
Selection:
Compare item with the data you are looking for [1]
If they are the same then stop [1]
If they are not the same move on to next item [1]
Loop: Repeat steps above [1]
4b Advantage – more efficient [1] and faster [1] than bubble or insertion 2
sort. Max 1
Disadvantage – complex to code [1]
5b Quicker [1] 1
6a length = input (“Please enter the length”)[1] //Ask the user for the Any appropriate 8
length of the rectangle. [1] comment
width = input (“Please enter the width”)[1] //Ask the user for the accepted
width of the rectangle. [1]
area = length * width [1] //Find the area by multiplying the length by
the width. [1]
print (“The area of the square is: “+ area)[1] //output the area. [1]
Edulito©2017 Page 11
GCSE Computer Science (9-1) Algorithms - Topic Test
Edulito©2017 Page 12