placeholder image to represent content

Lists in Python

Quiz by Amanda Oliver

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

Correct quiz answers unlock more play!

New Quizalize solo game modes
9 questions
Show answers
  • Q1
    Which of the following is true for Python lists?
    These represent the same list: ['a', 'b', 'c'] ['c', 'a', 'b']
    All elements in a list must be of the same type
    A list may contain any type of object except another list
    A given object may appear in a list more than once
    30s
  • Q2
    Given a = ['foo', 'bar', 'baz', 'qux', 'quux', 'corge'], which display is incorrect?
    print(a[-5:-3]) ['bar', 'baz']
    print(a[-6]) will result in an error since -6 is an invalid index
    print(a[4::-2]) ['quux', 'baz', 'foo']
    45s
  • Q3
    Let list1 = [3, 4, 5, 18, 5, 22, 1, 2], what is len(list1)?
    6
    5
    8
    7
    30s
  • Q4
    list1 = [1, 3, 2, 4, 5, 2, 1, 0], What is list1[:-1]?
    [1, 3, 2, 4, 5, 2]
    [1, 3, 2, 4, 5, 2, 1]
    [1, 3, 2, 4, 5, 2, 1, 0]
    0
    30s
  • Q5
    Let list1 = [0, 3, 2], what is sum(list1)?
    3
    4
    5
    2
    30s
  • Q6
    __________ creates a ist
    list 1
    list1 = []
    list() = {1, 2, 3]
    list1 = list()
    30s
  • Q7
    What is list("pqrs")?
    ['rs']
    ['pqrs']
    ['pq']
    ['p', 'q', 'r', 's']
    30s
  • Q8
    What is the output when we execute list(“hello”)
    [‘hello’]
    [‘olleh’]
    [‘h’, ‘e’, ‘l’, ‘l’, ‘o’]
    [‘llo’]
    30s
  • Q9
    What will be the output of the following code snippet?
    Question Image
    [1, 2, 3]
    [2, 3]
    [1, 3]
    [3, 2]
    30s

Teachers give this quiz to your class