
Lists in Python
Quiz by Amanda Oliver
Feel free to use or edit a copy
includes Teacher and Student dashboards
Measure skillsfrom any curriculum
Measure skills
from any curriculum
Tag the questions with any skills you have. Your dashboard will track each student's mastery of each skill.
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
9 questions
Show answers
- Q1Which 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 typeA list may contain any type of object except another listA given object may appear in a list more than once30s
- Q2Given 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 indexprint(a[4::-2]) ['quux', 'baz', 'foo']45s
- Q3Let list1 = [3, 4, 5, 18, 5, 22, 1, 2], what is len(list1)?658730s
- Q4list1 = [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]030s
- Q5Let list1 = [0, 3, 2], what is sum(list1)?345230s
- Q6__________ creates a istlist 1list1 = []list() = {1, 2, 3]list1 = list()30s
- Q7What is list("pqrs")?['rs']['pqrs']['pq']['p', 'q', 'r', 's']30s
- Q8What is the output when we execute list(“hello”)[‘hello’][‘olleh’][‘h’, ‘e’, ‘l’, ‘l’, ‘o’][‘llo’]30s
- Q9What will be the output of the following code snippet?[1, 2, 3][2, 3][1, 3][3, 2]30s