Lesson 4.4.1.1
4.4.1.1 Problem-solving and algorithms Quiz: AQA Computer Science, Unit 4
20 questions
In partnership with Revision Ninja
Lesson 4.4.1.1, Problem-solving and algorithms: 20 multiple choice questions for the AQA Computer Science (7517), Unit 4: Theory of computation, 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
-
In the specification, what is an algorithm?
- A file format for storing images
- A piece of hardware that performs arithmetic operations on the data it is given to process
- A graph of connected nodes
- A sequence of steps that can be followed to complete a task and that always terminates
-
Which set of constructs is listed in the specification for pseudo-code?
- Input, output, process and store
- Sequence, assignment, selection and iteration
- Loop, branch, jump and call
- Sequence, recursion, goto and exception handling used in structured programs
-
What must every algorithm always do?
- Use a graphical interface
- Terminate
- Run for exactly one second
- Contain a loop
-
Which of these is NOT one of the standard pseudo-code constructs in the specification?
- Assignment
- Garbage collection
- Selection
- Iteration
-
Which method is used to argue that a program is correct and efficient, according to the specification?
- Logical reasoning, test data and user feedback
- Compiling it once
- Guessing the output of the program and checking the result against intuition
- Counting lines of code only
-
What is meant by hand-tracing an algorithm?
- Timing the algorithm with a stopwatch
- Running the algorithm on a computer, with breakpoints set at each important line of code
- Stepping through the algorithm manually and recording variable values at each step
- Converting the algorithm into machine code
-
Trace: x = 3, then while x < 10 set x = x * 2. What is the final value of x?
- 6
- 8
- 10
- 12
-
Algorithm: total = 0, then for i from 1 to 4 add i to total. What is the final total?
- 4
- 10
- 24
- 7
-
Ann, Ben and Cat: exactly one of them tells the truth. Ann says Ben is lying. Ben says Cat is lying. Cat says Ann and Ben are both lying. Who tells the truth?
- Ann
- Ben
- Cat
- No one
-
How many times is the body of 'for i = 1 to 5' executed?
- 1
- 4
- 5
- 6
-
Which pseudo-code selection correctly tests whether the integer n is even?
- IF n MOD 2 = 0 THEN
- WHILE n = 2
- n = n MOD 2 ENDIF
- IF n DIV 2 THEN
-
An algorithm finds the largest of a list of 7 values by comparing each item with the current maximum. How many comparisons are made?
- 7
- 8
- 6
- 49
-
Which test data is most useful for checking a sorting program?
- A list containing only the number 0
- An empty list, a single item, duplicates and an already-sorted list
- Only the largest possible values
- Random numbers tested once
-
Which kind of algorithm would fail the definition of an algorithm?
- One that performs a fixed number of steps
- One containing a loop with no exit condition for some valid input
- One that reads input from the user
- One that uses a selection statement
-
Which argument best supports the correctness of a loop?
- Counting the number of lines of code
- Comparing its compile time with another program
- Random sampling of its outputs across many different test runs to gain confidence
- A loop invariant that holds before each iteration and gives the result at the end
-
Is an algorithm that halts only for some valid inputs an algorithm under the specification's definition?
- Yes, all algorithms may run forever
- No, because pseudo-code cannot contain loops
- No, the definition requires termination for every input
- Yes, if the input is numeric
-
How many different orderings are there of three distinct items?
- 9
- 3
- 6
- 27
-
Trace the sequence: start with n = 12. While n > 1, halve n if it is even, otherwise set n = 3n + 1, counting each step. How many steps reach 1?
- 7
- 9
- 5
- 12
-
Two correct algorithms solve the same problem. A takes 100 steps and B takes 10 steps on every input. Which conclusion is valid?
- Neither can be compared
- B is more efficient on the step-count measure, so it is preferred on that basis
- A is more efficient because it is longer
- They are equal because both are correct
-
Which statement about testing and proof is correct?
- Proof is always unnecessary
- Testing can show errors on the cases tried but cannot alone prove correctness for all inputs
- Testing can prove the absence of all errors for any program
- User feedback proves correctness
Related quizzes
- Abstraction Quiz · 4.4.1.3 · 20 questions
- Problem reduction and decomposition Quiz · 4.4.1.8 · 20 questions
- Composition Quiz · 4.4.1.10 · 20 questions
- Automation Quiz · 4.4.1.11 · 20 questions
- Finite state machines Quiz · 4.4.2.1 · 20 questions
- Regular expressions Quiz · 4.4.2.3 · 20 questions
- Backus-Naur Form and syntax diagrams Quiz · 4.4.3.1 · 20 questions
- Comparing algorithms Quiz · 4.4.4.1 · 20 questions
- Order of complexity Quiz · 4.4.4.3 · 20 questions
- Limits of computation and computable problems Quiz · 4.4.4.4 · 20 questions