Lesson 4.1.1.2

4.1.1.2 Programming concepts: sequence, selection and iteration Quiz: AQA Computer Science, Unit 1

20 questions

In partnership with Revision Ninja

Lesson 4.1.1.2, Programming concepts: sequence, selection and iteration: 20 multiple choice questions for the AQA Computer Science (7517), Unit 1: Fundamentals of programming, 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. Which of these is NOT one of the three principles used to combine statements in imperative programming?

    • Inheritance
    • Iteration
    • Selection
    • Sequence
  2. What is selection in a program?

    • Executing statements one after another in order
    • Choosing between alternative paths depending on a condition
    • Repeating a block of statements a number of times
    • Declaring a constant with a fixed value
  3. What is definite iteration?

    • Repetition that continues until a condition becomes true, with no fixed count
    • Choosing one of several alternative paths
    • Running statements once in sequence
    • Repetition for a number of times known before the loop starts
  4. What is indefinite iteration?

    • Choosing between two alternative paths by testing a condition with an IF statement
    • Repetition for a fixed count that is set at the start of the loop and never changes
    • Running the same group of statements exactly once from top to bottom in sequence
    • Repetition controlled by a condition, where the number of repeats is not known in advance
  5. What does a condition at the end of a post-test loop mean for the loop body?

    • The body can never run
    • The loop cannot be exited early
    • The condition is checked before the first run
    • The body always runs at least once
  6. What does nested selection mean?

    • A selection with no condition
    • Two separate selections that run one after another
    • One selection statement placed inside another
    • A selection that repeats itself forever
  7. Why is it important to use meaningful identifier names in a program?

    • They make the program run faster when it is compiled
    • They reduce the amount of memory needed for variables
    • They allow the program to skip type checking
    • They make the code easier to read, understand and maintain
  8. Trace the code: x := 0; WHILE x < 3 DO x := x + 1 END WHILE. What is the final value of x?

    • 4
    • 3
    • 0
    • 2
  9. A REPEAT ... UNTIL loop sets count to 5, then the body decrements count by 1, and the loop ends when count = 0. How many times does the body run?

    • 1
    • 4
    • 6
    • 5
  10. A WHILE loop tests the condition at the start, and the condition is false before the first iteration. How many times does the body run?

    • 1
    • 0
    • It runs forever
    • 2
  11. sum := 0; FOR i := 1 TO 4 DO sum := sum + i END FOR. What is the final value of sum?

    • 12
    • 4
    • 10
    • 8
  12. A FOR loop runs i from 1 to 3 and, inside it, a nested FOR loop runs j from 1 to 2. How many times does the innermost body run?

    • 3
    • 9
    • 6
    • 5
  13. A program sets score to 49 and runs: IF score >= 50 THEN output pass ELSE output fail END IF. What is output?

    • 49
    • pass
    • fail
    • neither
  14. A program must display a menu at least once before deciding whether to repeat. Which loop structure is most suitable?

    • A pre-test (WHILE) loop
    • No loop, only selection
    • A FOR loop with a count of zero
    • A post-test (REPEAT ... UNTIL) loop
  15. A FOR loop counts i from 10 down to 1 in steps of 3, so i takes the values 10, 7, 4 and 1. How many iterations are there?

    • 10
    • 5
    • 3
    • 4
  16. A loop must keep reading integers until the user enters the sentinel value -1. Which type of iteration is most suitable?

    • Selection with no loop
    • Recursion with no base case
    • Definite iteration with a count of 10
    • Indefinite iteration controlled by a condition
  17. Why does a pre-test loop differ from a post-test loop when the condition is initially false?

    • A pre-test loop can only be used with a FOR count
    • A post-test loop never runs, while a pre-test loop always runs once
    • A pre-test loop may run zero times while a post-test loop runs at least once
    • Both loops always run the same number of times
  18. A program runs: x := 15; IF x > 10 THEN IF x > 20 THEN output high ELSE output mid END IF ELSE output low END IF. What is output?

    • low
    • high
    • mid
    • nothing
  19. A nested loop processes a grid with 4 rows and 5 columns, visiting every cell once. How many cells are visited in total?

    • 1024
    • 20
    • 25
    • 9
  20. Which of the following loops is definite iteration?

    • IF score > 50 THEN
    • REPEAT ... UNTIL valid
    • FOR i := 1 TO 10
    • WHILE NOT found DO

All AQA Computer Science quizzes