Instructions

  • 1. Your final score will reflect your grasp of the concepts—approach each question with precision.
  • 2. Thoroughly review each solution before proceeding to ensure full understanding.
  • 3. Final results will be available after submission to provide insights into areas for further improvement.
  • 4. Maintain academic integrity—plagiarism undermines learning and professional growth.
  • 5. Once submitted, responses are final, so ensure you’re confident in your answers.
  • 6. These challenges are designed to test practical knowledge; apply your skills as you would in real-world scenarios.

All Problems

Question

Action

What does list1.append(5) do?

View

What will list1.insert(1, 'a') do?

View

What does the list.remove(x) method do?

View

What will list.pop() return?

View

Which method returns the number of occurrences of an element?

View

What does list.sort(reverse=True) do?

View

What is the result of [1, 2, 3].index(2)?

View

What will list.extend([4, 5]) do for list = [1, 2, 3]?

View

Which method returns a reversed iterator of a list?

View

How do you clear all elements from a list?

View

What does list1.append(5) do?

Adds 5 at the beginning of the list
Adds 5 at the end of the list
Replaces the first element with 5
Inserts 5 at index 0

What will list1.insert(1, 'a') do?

Inserts 'a' at index 1
Replaces the element at index 1 with 'a'
Appends 'a' to the end
Removes the element at index 1

What does the list.remove(x) method do?

Removes all occurrences of x
Removes the first occurrence of x
Raises an error if x is not in the list
Both b and c

What will list.pop() return?

Removes and returns the first element
Removes and returns the last element
Clears the list
Raises an error if the list is empty

Which method returns the number of occurrences of an element?

count()
index()
len()
occurrences()

What does list.sort(reverse=True) do?

Sorts the list in ascending order
Sorts the list in descending order
Reverses the order of the list
Raises an error

What is the result of [1, 2, 3].index(2)?

2
1
[2]
Raises an error

What will list.extend([4, 5]) do for list = [1, 2, 3]?

[1, 2, 3, [4, 5]]
[1, 2, 3, 4, 5]
[4, 5, 1, 2, 3]
[1, 2, [4, 5], 3]

Which method returns a reversed iterator of a list?

list.reverse()
reversed(list)
list[::-1]
reverse()

How do you clear all elements from a list?

remove()
pop()
clear()
del list