Nested Selection & Iteration
Quiz by GCSE Computer Science Teacher 4
GCSE (AQA)
Computer Science
English National Curriculum
Feel free to use or edit a copy
includes Teacher and Student dashboards
Measures 1 skill from
Measures 1 skill from
Track each student's skills and progress in your Mastery dashboards
With a free account, teachers can
- edit the questions
- save a copy for later
- start a class game
- automatically assign follow-up activities based on students’ scores
- assign as homework
- share a link with colleagues
- print as a bubble sheet
10 questions
Show answers
- Q1What is meant by nested selection?One selection below another selection statement, which increases the conditionsOne iteration below another iteration, another which increases the conditionsOne iteration within another iteration, which increases the conditionsOne selection within another selection statement, which increases the conditions60s3.2.2.c
- Q2What is meant by nested iteration?One iteration below another iteration, which increases the conditionsOne iteration within another iteration, which increases the conditionsOne selection below another selection statement, which increases the conditionsOne selection within another selection statement, which increases the conditions60s3.2.2.c
- Q3What is this program is doing?Looping through 10 times to check there are 8 charactersChecking if the password is equal to the usernameChecking if the password is equal to the username and if it's over 8 charactersChecking if it's 8 characters60s3.2.2.c
- Q4Which 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 ENDFORDO i <-- 1 TO 10 DO j <-- 1 to 10 OUTPUT j * i ENDDO ENDWHILE I <-- 1 TO 10 WHILE j <-- 1 to 10 OUTPUT j * i ENDWHILE ENDWHILEFOR i <-- 1 TO 10 FOR j <-- 1 to 10 OUTPUT j * i ENDFOR ENDFOR60s3.2.2.c
- Q5Why do we need separate variables for i and j? FOR i <-- 1 TO 10 FOR j <-- 1 to 10 OUTPUT j * i ENDFOR ENDFORA DO-UNTIL loop should have been usedA while loop should have been usedThe i and j would always be the same value as it would be replaced each timeIt could have been i and j because it would show all of the times table30s3.2.2.c
- Q6What 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 ENDWHILEFOR i <-- 1 TO 10 FOR j <-- 1 to 10 OUTPUT j + i ENDFOR ENDFORDO UNTIL i <-- 1 TO 10 DO UNTIL i <-- 1 to 10 OUTPUT i + iFOR i <-- 1 TO 10 FOR i <-- 1 to 10 OUTPUT i + i ENDFOR ENDFOR120s3.2.2.c
- Q7What 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 WHILEWHILE gamePlay = "Y" DO username <-- USERINPUT UNTIL username != "" END WHILEDO username <-- USERINPUT UNTIL username != ""FOR gamePlay = "Y" DO username <-- USERINPUT UNTIL username != "" END FOR120s3.2.2.c
- Q8Which 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") ENDWHILEage = 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") ENDWHILEage = 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") ENDIFage = 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") ENDIF120s3.2.2.c
- Q9Why do you need to be careful using nested selection or iteration?They are not efficient when combinedThey are only used in some langaugesIt can be become confusing with multiple conditionsThey are difficult to program60s3.2.2.c
- Q10How many times in total will hello be output?4816260s3.2.2.c