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.

Host this setFree Play

The 20 questions

  1. 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
  2. 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
  3. What must every algorithm always do?

    • Use a graphical interface
    • Terminate
    • Run for exactly one second
    • Contain a loop
  4. Which of these is NOT one of the standard pseudo-code constructs in the specification?

    • Assignment
    • Garbage collection
    • Selection
    • Iteration
  5. 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
  6. 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
  7. Trace: x = 3, then while x < 10 set x = x * 2. What is the final value of x?

    • 6
    • 8
    • 10
    • 12
  8. Algorithm: total = 0, then for i from 1 to 4 add i to total. What is the final total?

    • 4
    • 10
    • 24
    • 7
  9. 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
  10. How many times is the body of 'for i = 1 to 5' executed?

    • 1
    • 4
    • 5
    • 6
  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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
  17. How many different orderings are there of three distinct items?

    • 9
    • 3
    • 6
    • 27
  18. 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
  19. 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
  20. 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

All AQA Computer Science quizzes