Skip to main content

Posts

Showing posts with the label Python Interview Questions

Python interview questions. Part III. Senior Level

  Questions Q: Python is always called an easy language. Will you agree with it? Q: What are the pitfalls and problems of Python language? Q: How does a framework differ from a library? Q: Is it possible to use the construction  True = False ? Q: When will the  else  part of  try...except...else  be executed? Q: What is monkey patching? How to use it in Python? Example? Is it ever a good idea? Q: How are  dict  and  set  implemented internally? What is the complexity of retrieving an item? How much memory do these structures consume? Q: Does Python support multiple inheritance? How does it solve the diamond problem? Q: What is MRO in Python? How does it work? Q: Does Python have an assignment operator? How is the assignment process in Python different from C/C++? Q: What are descriptors? Is there a difference between a descriptor and a decorator? Q: How are arguments passed to a function in Python — by value or by reference? Q: What tool...

Python interview questions. Part II. Middle

Questions Q: What is the output of  -12 % 10 ? Q: What is the output of  -12 // 10 ? Q: What is the sequence of call operators in the expression  a * b * c ? Q: Why shouldn't you make the default arguments an empty list? Q: What  id()  function in Python is for? Q: What is the  yield  keyword used for in Python? Q: What is an iterator in Python? Can you write an example? Q: What is a generator in Python? How are they different from iterators? Q: What is the difference between  __iter__  and  __next__ ? Q: How do you create a dictionary that can preserve the order of pairs? Q: What is a context manager? How are they different from  try ... finally ? Q: Which functions must be overridden in a class in order for its instances to implement the context manager protocol? Q: What is the synchronous code? What is asynchronous code? How to write asynchronous code? Q: What is  unittest  module in Python? How to write tests in P...

Python interview questions. Part I. Junior

  Questions Q: What is Python? Q: What is the lambda function in Python? Why does it exist in Python? Q: What is  pass  in Python? Q: What is  *args ,  **kwargs  in function definition? Q: What is docstring in Python? How to write them? Are they required? Q: What are the built-in data types that Python provides? Which of them are mutable, which are immutable? Q: What is the difference between list and tuple types in Python? Q: What keywords can be used in conjunction with the  for  keyword? Q: What could be the key in  dict ? Q: What's the difference between  globals() ,  locals() , and  vars() ? Q: What is PEP8 ? Q: What is slicing in Python? Q: Is it possible to have a negative index in iterative types in Python? Q: What is the  __init__.py  module? What it's for? Q: How can I swap values of variables in Python? Q: How do I view object methods? Q: How do you get documentation on objects' methods in Python? Q: W...