Python interview questions. Part I. Junior

Python interview questions. Part I. Junior

I am starting a series of posts about my own base of interviewing questions. Of course, it is not full and it doesn't have any answers and maybe some of the questions seem weird or even stupid, but I think they are good for finding the right candidate for Python position.


Questions

Q: What is Python?

Q: What is lambda in Python?

Q: What is pass in Python?

Q: What is *args, **kwargs in function definition?

Q: What is docstring in Python?

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?

Q: What keywords can be used in conjunction with the for keyword?

Q: What could be the dict key?

Q: What's the difference between globals(), locals(), and vars()?

Q: What is PEP8?

Q: What is slicing in Python?

Q: What is the negative index in Python?

Q: What is the __init__.py module? What it's for?

Q: How can I change the values of two variables to Python?

Q: How do I see the object methods?

Q: How do you get documentation on objects' methods in Python?

Q: What is a module in python? What is a python package? What is the difference between packages and modules?

Q: Can you write multithreading applications in Python? What the difference between multithreading, multiprocessing?

Q: What is a decorator? How to create custom decorator?

Q: What is @classmethod, @staticmethod, @property?

Q: What is the difference between @classmethod and @staticmethod?

Q: Does Python fully support OOP?

Q: What is the __dict__ attribute of an object in Python?

Q: What is self?

Q: What are __init__ functions?

Q: Explain how to make a Python script executable on Unix?

Q: What is pickling and unpickling?

Code involving questions

Q: How to translate a string containing a binary code (1 and 0) into a number (integer)? Write a program for this.

Q: How to check that tuple A contains all elements of tuple B. Do both tuples contain unique values? Write a program for this.

Q: What will be the output of the following code?

def f():
     x = 15
     print(x)
x = 12
f()

Q: How to convert a string to a number that consists of letters ASCII code. Example: 'abcd' -> 979899100. Write a program for this.

Q: How to remove empty lines from a list of lines (with a length of 0). Write a program for this.

Q: Write a program that counts all distinct pairs with a difference equal to k

Q: Build a string with the numbers from 0 to 100, "0123456789101112..."

Q: Making a list with the unique element from a list with duplicate elements

Q: Make a prime number list from range (1,100)

Next:

Python interview questions. Part II. Middle

Python interview questions. Part III. Senior


Buy me a coffee