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.
The 20 questions
-
Which of these is NOT one of the three principles used to combine statements in imperative programming?
- Inheritance
- Iteration
- Selection
- Sequence
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
sum := 0; FOR i := 1 TO 4 DO sum := sum + i END FOR. What is the final value of sum?
- 12
- 4
- 10
- 8
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
Which of the following loops is definite iteration?
- IF score > 50 THEN
- REPEAT ... UNTIL valid
- FOR i := 1 TO 10
- WHILE NOT found DO
Related quizzes
- Data types Quiz · 4.1.1.1 · 20 questions
- Arithmetic operations Quiz · 4.1.1.3 · 20 questions
- Relational and Boolean operations Quiz · 4.1.1.4 · 20 questions
- Constants and variables Quiz · 4.1.1.6 · 20 questions
- String-handling operations Quiz · 4.1.1.7 · 20 questions
- Random numbers and exception handling Quiz · 4.1.1.8 · 20 questions
- Subroutines Quiz · 4.1.1.10 · 20 questions
- Parameters and returning values Quiz · 4.1.1.11 · 20 questions
- Local and global variables Quiz · 4.1.1.13 · 20 questions
- Stack frames in subroutine calls Quiz · 4.1.1.15 · 20 questions