Skip to main content

List Quiz: 03

Mejbah Ahammad

Python Lists Quiz - Set 3

Python Lists Quiz - Set 3

Answer the following questions about Python lists by selecting the correct options:

Time Remaining: 10:00

1. What does this code print?

x = [4, 8, 2]
x.sort(reverse=True)
print(x)

2. What will be the result of this code?

x = [1, 2, 3, 2]
x.remove(2)
print(x)

3. What will this code output?

x = [10, 20, 30]
x.insert(2, 25)
print(x)

4. What does the following code output?

x = [5, 10, 15]
print(len(x))

5. What does the following code print?

x = ["a", "b", "c"]
print(x[2])

6. What will this code output?

x = [5, 10, 15]
y = x.copy()
y[1] = 20
print(x)

7. What does this code output?

x = [2, 4, 6]
print(min(x))

8. What will this code output?

x = [3, 6, 9]
print(x.index(6))

9. What will the following code output?

x = [0] * 4
print(x)

10. What does the following code output?

x = ["apple", "banana", "cherry"]
print("banana" in x)