Examplary
Start for free
Oak ComputingTest · Computing

2D arrays and lists

The starter and exit quiz of the lesson “2D arrays and lists”, from the unit “Programming: strings and lists” (Year 10 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. What does this code do?animals = ["dog", "cat", "rabbit"]animals.insert(1, "hamster")print(animals)
  2. What will be the output of the following code?colors = ["red", "blue", "green", "blue"]print(colors.count("blue"))
  3. Which method would you use to add an item to the end of a list?
  4. What does the pop() method do in a Python list?
  5. What is the correct way to remove "apple" from the following list?fruits = ["banana", "apple", "cherry"]
  6. A ___ can return multiple values by placing them in a list.
  7. What is a two-dimensional (2D) list?
  8. How do you access the value at row index 1 and column index 2 in the following 2D list?grades = [ ["Math", "Science", "History"], [85, 90, 78]]
  9. Which of the following correctly defines a 2D list in Python?
  10. What will be the output of the following code?table = [ ["apple", "banana", "cherry"], [3, 2, 5]]print(table[0][1])
  11. The ___() method can be used to add a new row to a 2D list.
  12. How can you change the value "dog" to "cat" in the following 2D list?animals = [ ["lion", "tiger", "dog"], ["parrot", "eagle", "owl"]]

License: OGL

2D arrays and lists · Examplary