Lists Questions and Answers

Take Exam

Python Programming - Lists Questions with Answers explore the most flexible and commonly used data structure. These Python Lists Questions are helpful for Infosys, SSC, and Wipro exams focusing on sequence and iteration concepts

Lists

Showing 10 of 25 questions

1. Which method is used to add an element to the end of a list in Python?

  • add()
  • append()
  • insert()
  • push()
Show Answer Report

2. How do you access the last element of a list called "my_list"?

  • my_list[0]
  • my_list[last]
  • my_list[-1]
  • my_list[end]
Show Answer Report

3. Which method removes and returns the last element from a list?

  • remove()
  • delete()
  • pop()
  • cut()
Show Answer Report

4. What is the output of len([1, 2, 3, [4, 5]])?

  • 4
  • 5
  • 6
  • Error
Show Answer Report

5. Which method is used to reverse a list in-place?

  • reversed()
  • reverse()
  • flip()
  • invert()
Show Answer Report

6. How do you create a shallow copy of a list?

  • list.copy()
  • list[:]
  • copy(list)
  • Both A and B
Show Answer Report

7. What does the extend() method do?

  • Adds a single element to the list
  • Adds multiple elements from an iterable
  • Increases the list size by a fixed amount
  • Creates a new extended list
Show Answer Report

8. How do you find the index of the first occurrence of an element in a list?

  • find()
  • search()
  • index()
  • locate()
Show Answer Report

9. Which method removes the first occurrence of a value from a list?

  • delete()
  • remove()
  • pop()
  • discard()
Show Answer Report

10. What is the difference between append() and extend()?

  • No difference
  • append() adds elements, extend() removes elements
  • append() adds single element, extend() adds multiple elements
  • append() works only with strings
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test