Showing posts with label Method. Show all posts
Showing posts with label Method. Show all posts

Friday, September 11, 2026

Python List Methods Quiz

 Python List Methods Quiz


1. What is the output? numbers = [10, 20, 30] numbers.append([40, 50]) print(numbers)

   A. [10, 20, [40, 50], 30]

   B. [40, 50, 10, 20, 30]

   C. [10, 20, 30, [40, 50]]

   D. [10, 20, 30, 40, 50]


2. What is the output? x = [1, 2, 3] x.insert(1, 99) print(x)

   A. [1, 99, 2, 3]

   B. [1, 2, 3, 99]

   C. [1, 2, 99, 3]

   D. [99, 1, 2, 3]


3. What is the output? x = [5, 10, 5, 20] x.remove(5) print(x)

   A. [10, 5, 20]

   B. [5, 10, 5, 20]

   C. [10, 20]

   D. [5, 10, 20]


4. What is the output? x = [10, 20, 30] y = x.pop() print(x, y)

   A. [10, 20, 30] None

   B. [10, 20] 30

   C. [20, 30] 10

   D. [10, 30] 20


5. What is the output? x = [30, 10, 20] x.sort(reverse=True) print(x)

   A. [30, 20, 10]

   B. [20, 10, 30]

   C. [30, 10, 20]

   D. [10, 20, 30]