blog-cover-image

30 Advanced Python Interview Questions with Answers

This collection of 30 tricky Python interview questions covers core topics from data types and mutability to advanced scenarios involving iterators, generators, decorators, and common Python pitfalls. 


a = [1, 2, 3]
b = a
a.append(4)
print(b)
  • A. [1, 2, 3, 4]
  • B. [1, 2, 3]
  • C. [4]
  • D. Error

Correct answer: A

Explanation: Both a and b point to the same list object in memory. When a.append(4) is called, the list is modified in place. So b reflects the same change.