Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

Python interviews focus on the language features that separate working knowledge from fluency. Expect questions on when to use each built-in data structure, mutable default arguments, generators and laziness, decorators and functools.wraps, the Global Interpreter Lock and how it shapes your concurrency choice, and how reference counting and the cycle collector manage memory. Employers also probe testing and code quality practice. The questions below cover the language and the judgement around using it well.

Python MCQ

2.Why can a tuple be used as a dictionary key but a list cannot?

3.What is the time complexity of checking membership with 'in' on a set?

4.What is wrong with def add(item, bucket=[]) as a function signature?

5.What does the @staticmethod decorator do?

6.What is a generator in Python?

7.What does the Global Interpreter Lock prevent?

8.Which module should be used for CPU-bound parallelism in Python?

9.What does *args collect in a function signature?

10.Why is a bare 'except:' clause considered bad practice?

11.What is the difference between a shallow copy and a deep copy?

12.What does the with statement provide?

13.What does functools.wraps do in a decorator?

14.Which method is called when an object is created and initialised?

15.What is the difference between __str__ and __repr__?

16.What does a list comprehension such as [x*2 for x in data] return?

17.How does Python pass arguments to functions?

18.Which statement about Python's garbage collection is correct?

19.What does the enumerate() function provide?

20.What does the zip() function do?

21.Which of these correctly opens a file for reading and guarantees it is closed?

22.What is the difference between a module and a package in Python?

23.What does the 'is' operator compare?

24.What is a virtual environment used for?

25.Which statement about Python dictionaries since version 3.7 is correct?

26.What does the @property decorator allow?

27.What is the purpose of the __init__.py file in a package?

28.Which exception is raised when accessing a dictionary key that does not exist?

29.What does the else clause of a try statement do?

31.What does list.sort() return?

32.What is the purpose of type hints in Python?

33.Which of these creates a dictionary comprehension?

34.What does the @dataclass decorator generate automatically?

35.What does the asyncio library provide?

36.Which statement about Python string immutability is correct?

37.What does the collections.defaultdict class do?

38.How should a password be stored in a Python application?

39.What is the purpose of the if __name__ == '__main__': guard?

41.What does the itertools module provide?

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as