NEW
Font size
WorksheetsQUIZ1
Total questions: 10
Worksheet time: 5mins
What is the output of the following list assignment
aList = [4, 8, 12, 16]
aList[1:4] = [20, 24, 28]
print(aList)
[4, 20, 24, 28, 8, 12, 16]
[4, 20, 24, 28]
What is the output of the following list operation
aList = [10, 20, 30, 40, 50, 60, 70, 80]
print(aList[2:5])
print(aList[:4])
print(aList[3:])
[20, 30, 40, 50]
[10, 20, 30, 40]
[30, 40, 50, 60, 70, 80]
[30, 40, 50]
[10, 20, 30, 40]
[40, 50, 60, 70, 80]
None of these
What is the output of the following
aList = [5, 10, 15, 25]
print(aList[::-2])
[15, 10, 5]
[10, 5]
[25, 10]
In Python, list is mutable
False
True
Which of the following would give an error?
list1=[]
list1=[]*3
list1=[2,8,7]
None of the above
Suppose list1 is [1, 3, 2], What is list1 * 2 ?
[2, 6, 4].
[1, 3, 2, 1, 3]
[1, 3, 2, 1, 3, 2]
[1, 3, 2, 3, 2, 1]
___________ method adds one list at the end of another list.
extend( )
append( )
insert( )
____________function can be used to insert an element/object at a specified index.
extend( )
insert ( )
append( )
Is this the correct code for a list?
register = {"Sam", "Pheobe", Georgia", Richard"}
Yes
No
To print a list called fruitList we use
print(fruitList)
list(print)
fruitList.print()
fruitList(print)
