Python Arrays Questions and Answers

Take Exam

Python Programming - Arrays Questions with Answers explain how to store and access multiple values efficiently. These Python Arrays Questions are essential for TCS, SSC, and Infosys exams covering fundamental data structure concepts

Python Arrays

Showing 10 of 25 questions

1. What is the time complexity of accessing an element in a Python list by index?

  • O(1)
  • O(n)
  • O(log n)
  • O(n²)
Show Answer Report

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

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

3. What is the output of [1, 2, 3] * 2 in Python?

  • [1, 2, 3, 1, 2, 3]
  • [2, 4, 6]
  • [1, 2, 3, 2]
  • Error
Show Answer Report

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

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

5. How do you create a copy of a list in Python?

  • list.copy()
  • list.clone()
  • list.duplicate()
  • list.replicate()
Show Answer Report

6. What does the extend() method do in Python lists?

  • Adds elements from an iterable to the end
  • Increases the list size by specified number
  • Extends memory allocation for the list
  • Creates a new extended list
Show Answer Report

7. Which method returns the index of the first occurrence of an element in a list?

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

8. What is the time complexity of inserting an element at the beginning of a Python list?

  • O(n)
  • O(1)
  • O(log n)
  • O(n²)
Show Answer Report

9. How do you reverse a list in-place in Python?

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

10. What is the difference between remove() and pop() methods?

  • remove() deletes by value, pop() by index
  • remove() returns the element, pop() does not
  • pop() works only for numbers, remove() for all types
  • There is no difference
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test