# Nested Selection & Iteration

## Quiz by GCSE Computer Science Teacher 4

GCSE (AQA)
Computer Science
English National Curriculum

### Our brand new solo games combine with your quiz, on the same screen

Correct quiz answers unlock more play!

10 questions
• Q1
What is meant by nested selection?
One selection below another selection statement, which increases the conditions
One iteration below another iteration, another which increases the conditions
One iteration within another iteration, which increases the conditions
One selection within another selection statement, which increases the conditions
60s
3.2.2.c
• Q2
What is meant by nested iteration?
One iteration below another iteration, which increases the conditions
One iteration within another iteration, which increases the conditions
One selection below another selection statement, which increases the conditions
One selection within another selection statement, which increases the conditions
60s
3.2.2.c
• Q3
What is this program is doing?
Looping through 10 times to check there are 8 characters
Checking if the password is equal to the username and if it's over 8 characters
Checking if it's 8 characters
60s
3.2.2.c
• Q4
Which is the correct code for a nested loop to show all the times table?
FOR i <-- 1 TO 10 FOR I <-- 1 to 10 OUTPUT j * i ENDFOR ENDFOR
DO i <-- 1 TO 10 DO j <-- 1 to 10 OUTPUT j * i ENDDO END
WHILE I <-- 1 TO 10 WHILE j <-- 1 to 10 OUTPUT j * i ENDWHILE ENDWHILE
FOR i <-- 1 TO 10 FOR j <-- 1 to 10 OUTPUT j * i ENDFOR ENDFOR
60s
3.2.2.c
• Q5
Why do we need separate variables for i and j? FOR i <-- 1 TO 10 FOR j <-- 1 to 10 OUTPUT j * i ENDFOR ENDFOR
A DO-UNTIL loop should have been used
A while loop should have been used
The i and j would always be the same value as it would be replaced each time
It could have been i and j because it would show all of the times table
30s
3.2.2.c
• Q6
What code will add two values together for every number from 1 to 10?
WHILE i <-- 1 TO 10 WHILE i <-- 1 to 10 OUTPUT i + i ENDWHILE ENDWHILE
FOR i <-- 1 TO 10 FOR j <-- 1 to 10 OUTPUT j + i ENDFOR ENDFOR
DO UNTIL i <-- 1 TO 10 DO UNTIL i <-- 1 to 10 OUTPUT i + i
FOR i <-- 1 TO 10 FOR i <-- 1 to 10 OUTPUT i + i ENDFOR ENDFOR
120s
3.2.2.c
• Q7
What code has created a nested iteration to check whether the user still wants to play the game, and whether they have inputted their name with at least one character?
WHILE gamePlay = "Y" END WHILE
WHILE gamePlay = "Y" DO username <-- USERINPUT UNTIL username != "" END WHILE
FOR gamePlay = "Y" DO username <-- USERINPUT UNTIL username != "" END FOR
120s
3.2.2.c
• Q8
Which program will check if someone is less than 18 and if they're, check whether they're a child or teenager?
age = USERINPUT WHILE age > 18 OUTPUT "Now checking if you're a child or teenager" IF age < 13 OUTPUT("You're a child") ELSE OUTPUT("You're a teenager") ENDWHILE
age = USERINPUT WHILE age > 18 OUTPUT "Now checking if you're a child or teenager" WHILE age < 13 OUTPUT("You're a child") ELSE OUTPUT("You're a teenager") ENDWHILE
age = USERINPUT IF age > 18 OUTPUT "Now checking if you're a child or teenager" IF age < 13 OUTPUT("You're a child") ELSE OUTPUT("You're a teenager") ENDIF
age = USERINPUT IF age < 18 OUTPUT "Now checking if you're a child or teenager" IF age < 13 OUTPUT("You're a child") ELSE OUTPUT("You're a teenager") ENDIF
120s
3.2.2.c
• Q9
Why do you need to be careful using nested selection or iteration?
They are not efficient when combined
They are only used in some langauges
It can be become confusing with multiple conditions
They are difficult to program
60s
3.2.2.c
• Q10
How many times in total will hello be output?
4
8
16
2
60s
3.2.2.c

Teachers give this quiz to your class