Lesson T1.2.3
T1.2.3 Comparing the utility of algorithms Quiz: KS3 Computing, Unit 1
20 questions
In partnership with Revision Ninja
Lesson T1.2.3, Comparing the utility of algorithms: 20 multiple choice questions for the KS3 Computing (National Curriculum), Unit 1: Computational thinking and algorithms, written with Revision Ninja.
Host it live on the board and students join with a game code on their own devices, or revise alone with Free Play. The answers are revealed in the game.
The 20 questions
-
Why compare two algorithms that solve the same problem?
- To check that they both use the same number of lines
- To decide which one has the most attractive name
- To make sure the programmer can avoid writing any code
- To judge which one is faster or uses fewer steps
-
Which measure is commonly used to judge an algorithm?
- The number of steps or comparisons it needs
- The size of the font used in the code
- The colour of the screen it is shown on
- The name of the person who wrote it
-
Binary search and linear search both search a sorted list of 1000 items. Which needs fewer checks in the worst case?
- Binary search
- Linear search
- Neither can search a sorted list
- They always need exactly the same number
-
Which sort makes the fewest swaps in general?
- Neither sort ever changes the order of items
- Both always make exactly the same number of swaps
- Selection sort, which makes at most one swap per pass
- Bubble sort, which swaps every neighbouring pair
-
Algorithm A takes 5 seconds and algorithm B takes 2 seconds to do the same task. Which is more efficient?
- Algorithm B
- They are equally efficient
- Neither can be judged from times
- Algorithm A
-
Two algorithms always give the correct answer. Why might one still be preferred?
- It uses less time or less memory
- It uses more lines of code to look impressive
- It has a longer name in the programming book
- It needs a bigger screen to display its output
-
Which of these is NOT a reason to choose one algorithm over another?
- How much memory it needs
- The colour of the screen it is displayed on
- How reliably it gives the right answer
- How quickly it finishes
-
Linear search on 50 items takes about 25 checks on average. About how many checks does binary search need on 50 sorted items?
- About 6
- About 25
- About 1
- About 50
-
Why is worst-case behaviour used when comparing algorithms?
- It shows the most steps the algorithm could possibly need
- It shows the fewest steps the algorithm could ever need
- It shows how many people have used the algorithm
- It shows how long the programmer spent writing it
-
What does 'the utility of an algorithm' mean?
- How often it is printed in textbooks
- How many pages of documentation it has
- How many different programming languages it can be written in
- How useful it is for a particular problem, judged with evidence
-
One sort uses 10 comparisons to sort 5 items and another uses 4. Which uses fewer comparisons?
- The one that used 4 comparisons
- The one that used 10 comparisons
- Neither can be counted
- Both used the same number of comparisons
-
Algorithm X only works on sorted lists. Algorithm Y works on any list. For an unsorted list used once, which is more useful?
- Algorithm X
- Neither is useful for lists
- Both are equally useful
- Algorithm Y
-
Why should logical reasoning be used to compare algorithms?
- To avoid testing the algorithms on real data
- To prove that every algorithm is equally good
- To make the algorithms look more complicated to others
- To justify a choice with clear evidence rather than guesswork
-
Binary search runs on the sorted list [2, 4, 6, 8, 10]. Which item is checked first?
- 6
- 8
- 4
- 2
-
Algorithm P needs 3 times n steps and algorithm Q needs n times n steps. For n equal to 10, which is quicker?
- Algorithm P, with 30 steps against 100 steps
- Neither can finish for n equal to 10
- Algorithm Q, with 30 steps against 100 steps
- Both need exactly 100 steps
-
Why would bubble sort be a poor choice for a list of a million items?
- It cannot sort any list containing more than five items
- It makes very many comparisons and swaps, so it becomes very slow
- It can only sort lists that contain words
- It always changes the values stored in the list
-
An algorithm is correct but takes a long time. How is it best described?
- Incorrect and therefore useless
- Efficient but unable to finish
- Correct but less efficient
- Fast but always wrong
-
Insertion sort is run on a list that is already sorted. How many swaps does it need?
- About half of the items
- None
- One for each item in the list
- All of the items
-
An app searches a large sorted database many times. How should a developer choose between two algorithms?
- Pick whichever algorithm uses the most lines of code, since it looks more thorough
- Compare their steps on realistic data sizes and pick the faster one
- Pick at random so that the choice is fair to every algorithm being considered
- Pick whichever algorithm was written first, since older methods are more reliable
-
Which method is generally best for finding an item in a sorted list of a million items?
- Checking from a random starting point
- Binary search
- Linear search
- Reading the list backwards by hand
Related quizzes
- Computational abstractions of real-world systems Quiz · T1.1.1 · 20 questions
- Sorting algorithms Quiz · T1.2.1 · 20 questions
- Searching algorithms Quiz · T1.2.2 · 20 questions
- Solving problems with two or more programming languages Quiz · T2.1.1 · 20 questions
- AND, OR and NOT Quiz · T3.1.1 · 20 questions
- Hardware and software components Quiz · T4.1.1 · 20 questions
- Combining applications across devices Quiz · T5.1.1 · 20 questions
- Using technology safely, respectfully and responsibly Quiz · T6.1.1 · 20 questions
- Textual programming languages Quiz · T2.1.2 · 20 questions
- Boolean logic in circuits and programming Quiz · T3.1.2 · 20 questions