1. What is the difference between mutable and immutable objects in Python?
2. Which of the following Python objects is immutable?
3. What happens when you pass a list to a Python function and modify the list inside the function?
4. What is the difference between a module and a package in Python?
5. What is the purpose of __init__.py in a Python package?
6. What is the difference between import module and from module import name?
7. What is the purpose of if __name__ == "__main__": in Python?
8. What is serialization in Python?
9. Which Python module is commonly used for JSON serialization and deserialization?
10. What is the difference between json.dumps() and json.loads()?
11. What is an iterator in Python?
12. Which methods are commonly used to implement an iterator?
13. What exception is raised when an iterator has no more values?
14. What will be the output? x = [1, 2, 3] print(x * 2)
15. What will be the output? a = [1, 2, 3] b = a a.append(4) print(b)
16. What is the time complexity of dictionary lookup on average in Python?
17. Why are dictionaries generally fast for key-based lookup?
18. What is the average time complexity of searching for an element in a Python list?
19. What is the difference between append() and extend() for a list?
20. What will be the output? x = [1, 2] x.extend([3, 4]) print(x)
21. What is the difference between remove(), pop(), and del for lists?
22. What is the difference between sort() and sorted()?
23. What will be the output? numbers = [3, 1, 2] result = sorted(numbers) print(numbers) print(result)
24. What is the purpose of virtual environments in Python?
25. What is pip in Python?