Home > Python > Quizzes > Python Programming Basics Practice Test: Different Types Of Python Lists
Python Programming Basics Practice Test: Different Types Of Python Lists
Fast practice, instant feedback. Timer auto-submits when time’s up.
Avg score: 66% Most missed: “Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1]?”
Here are some different types of lists in Python: Regular lists: These are the most common type of list, and can store any type of data, including numbers, strings, and other lists. Tuples: Tuples are similar to lists, but they are immutable, meaning that they cannot be changed once they are created. Dictionaries: Dictionaries are a type of list that stores data in key-value pairs. The key can be any type of data, and the value can be any type of data. Sets: Sets are a type of list that stores unique values. Sets are unordered, meaning that the order of the elements in the set does not... Show more
Python Programming Basics Practice Test: Different Types Of Python Lists
Time left 00:00
25 Questions

1. What will be the output of the following Python code?
def m(list):
v = list[0]
for e in list:
if v < e: v = e
return v
 
values = [[3, 4, 5, 1], [33, 6, 1, 2]]
 
for row in values:
print(m(row), end = " ")
2. What will be the output of the following Python code?
>>>names = ['Amir', 'Bear', 'Charlton', 'Daman']
>>>print(names[-1][-1])
3. What will be the output of the following Python code?
names1 = ['Amir', 'Bala', 'Chales']
 
if 'amir' in names1:
print(1)
else:
print(2)
4. Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1]?
5. To which of the following the “in” operator can be used to check if an item is in it?
6. What will be the output of the following Python code?
list1 = [1, 2, 3, 4]
list2 = [5, 6, 7, 8]
 
print(len(list1 + list2))
7. What will be the output of the following Python code?
names1 = ['Amir', 'Bala', 'Charlie']
names2 = [name.lower() for name in names1]
 
print(names2[2][0])
8. How many elements are in m?
m = [[x, y] for x in range(0, 4) for y in range(0, 4)]
9. Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.extend([34, 5])?
10. What will be the output of the following Python code?
>>>"Welcome to Python".split()
11. What will be the output of the following Python code?
values = [[3, 4, 5, 1], [33, 6, 1, 2]]
 
v = values[0][0]
for lst in values:
for element in lst:
if v > element:
v = element
 
print(v)
12. What will be the output of the following Python code?
>>>list("a#b#c#d".split('#'))
13. What will be the output of the following Python code?
matrix = [[1, 2, 3, 4],
[4, 5, 6, 7],
[8, 9, 10, 11],
[12, 13, 14, 15]]
 
for i in range(0, 4):
print(matrix[i][1], end = " ")
14. What will be the output of the following Python code?
>>>list1 = [11, 2, 23]
>>>list2 = [11, 2, 2]
>>>list1 < list2
15. Suppose list1 is [3, 4, 5, 20, 5], what is list1.index(5)?
16. What will be the output of the following Python code?
myList = [1, 5, 5, 5, 5, 1]
max = myList[0]
indexOfMax = 0
for i in range(1, len(myList)):
if myList[i] > max:
max = myList[i]
indexOfMax = i
 
>>>print(indexOfMax)
17. Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop()?
18. Suppose list1 is [2445,133,12454,123], what is max(list1)?
19. Suppose list1 is [1, 5, 9], what is sum(list1)?
20. What will be the output of the following Python code?
>>>m = [[x, x + 1, x + 2] for x in range(0, 3)]
21. What will be the output of the following Python code?
data = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]
 
print(data[1][0][0])
22. What will be the output of the following Python code?
def f(values):
values[0] = 44
 
v = [1, 2, 3]
f(v)
print(v)
23. What will be the output of the following Python code?
def addItem(listParam):
listParam += [1]
 
mylist = [1, 2, 3, 4]
addItem(mylist)
print(len(mylist))
24. What will be the output of the following Python code?
points = [[1, 2], [3, 1.5], [0.5, 0.5]]
points.sort()
print(points)
25. Suppose list1 = [0.5 * x for x in range(0, 4)], list1 is: