Examplary
Start for free
Oak ComputingTest · Computing

Using for loops to iterate data structures

The starter and exit quiz of the lesson “Using for loops to iterate data structures”, from the unit “Python programming with sequences of data” (Year 9 Computing) by Oak National Academy.

Free to use. Edit it, share it and hand it out to your students.

Oak National Academy

12 questions

  1. The process of repeating a sequence of instructions within a program loop is the definition of which term?
  2. ___ are organised collections of data.
  3. What is the term for a variable that is used to signal a change in a program's state?
  4. A while loop will continue to iterate until ...
  5. What would be displayed if this code was run?count = 1while True: print(count) count = count + 1
  6. What item is held in rolls[3] of this list?rolls = [1, 4, 3, 6]
  7. Which type of loop is used in Python for count-controlled iteration?
  8. What will the following code display?for count in range (1,8): print(count)
  9. A ___ loop is used for condition-controlled iteration.
  10. What does the len() function do?
  11. What would be the output of this code when it is run?rolls = [1, 4, 3, 6]count = 0for dice in rolls: count = count + 1print(count)
  12. What would be the output of this code when it is run?rolls = [1, 4, 3, 6]count = 0for dice in rolls: if dice >= 3: count = count + 1print(count)

License: OGL

Using for loops to iterate data structures · Examplary