In the current scenario, Pythons are very well known and highly sorted language. Due to the versatile nature of python, there are different Jobs available for Python developer. As Python is used for multi-purpose such as web-development, Data analysis, Artificial Intelligence etc. after having the knowledge of python and with some advance level Python you can apply for these jobs. But when you go for the Interview you may have to face some questions related to the python and if you give all answer correctly it can increase your chance to get that job.

Python Interview Question for Intermediate Level

Here in this article we have provided you 20 Most frequent questions often asked in python interview.

Question: What split() function do.
Answer: split() function is basically used for split the string into a list

Question: What are Django, Pyramid, and flask in Python?
Answer: Django: Django is a full stack Python web-framework.

Pyramid: Pyramid is also a Python web-framework which is used to build large web applications.

Flask: flask is a python microframework which is basically used to build small web applications.

Question: What is map() function does in Python?
Answer: the map function accepts 2 arguments the first argument can be a function or statement and the 2nd argument is the type which iterates through the first argument.

Question: what is “None” often used to Represent?
Answer: Absence of value.

Question: What will be the output of this code?
foo= print()

if foo==None:

Answer: 1

Question: What is floor division?
Answer:  the symbol of the floor division is “//” double division sign it basically divide one value with another and give the answer an integer value.


p= 12//5

2   #output

Question: Does python have a compiler?
Answer: Yes, python does a have the compiler. It’s works automatically.

Question: Name all data type used in Python.
Answer: 1. Integer

  1. String
  2. List


  1. Dictionary

Question: Write the statement to reverse the list.
Answer: list.reverse()

Question: What are all the file processing mode in python?
Answer: 1. “r”= Used for reading the file

  1. “w”= used for write and overwrite on in the file or create the new file.
  2. “rw”= use for both read and write simultaneously
  3. “a”= it used for append the file and can create a new file too.

Question: Explain the concept of *args and ** kwargs.
Answer: *args , It is a special kind of function definition which is used to pass multiple variables as arguments to the function. *args basically used when you are not sure about how many arguments passeds to the function.

# *args syntax:
def fun(*agrs): #here args is a variable you can choose other variable name too instead of args.
for i in args:
fun(“hellow”,”world”,”its” ,“an”, “args”,”function”)
# output

**kwargs: It is special kind of function in python which allow the user to mass multiple argument in the function. But in **kwargs the argument passes in the function as dictionaries.

# e.g of **kwargs:

def fun(**kwargs):
For k,v in kwargs.items():
Print(str(k) + “value is “+ str(v)
fun(k1=”value 1”,k2=”value 2”,k3=”value 3”)


k1 value is value 1
k2 value is value 2
k3 value is value 3

Question: How the Python interpreter work?
Answer: The Python interpreter consists two things one is compiler and second is a virtual machine. First, the compiler takes your source code and convert it into Byte code. Byte code is simply a lower level code which is platform independent. Then the byte code is fed into the PVM(Python Virtual Machine). The PVM execute the Byte code and give the output.

Question: Explain the .py and .pyc file extension.
Answer: the .py is the file extension of the Python programme, and .pyc is the file extension of the compiled byte code file which is generated by python.

Question: What is an Exception in python?
Answer: Exception can be defined as an event that occur due to incorrect code or input.

Question: What we use to deal with the exception?
Answer: to avoid the exception we can use try/except statement. If any exception occur, the code in try block stop execution and the code in the except block start to run.

# e.g.

except ZeroDivisionError:
print(“error has occurred because of zero division”)


an error has occurred because of zero division

Question: What is raise an exception?
Answer: to raise the exception and terminate the programme we can use raise exception statement.

# e.g.

raise ValueError



Question: Write all errors occurred in python.
Answer: Import error: it occurs when import statement fails

IndexError: when indexing of any list fails

NameError: undefined or unknown variable

SyntaxError: when the code is not written properly

TypeError: when an unappropriated variable is call.


There are many other exception or error in python. There are several exceptions in the third party libraries.

Question: What is NumPy?
Answer: it is a fundamental package which is basically used for scientific computation with Python.

Question: Give some main features of NumPy.
Answer: 1. It has a powerful N-dimensional array

  1. shophisticatd functions
  2. tools for integrating c/c++ and Fortran code
  3. useful linear algebra, Fourier transform, and random number capabilities.

Question: What is list comprehensions?
Answer: List comprehension is a method which can make the list in a concise way.


Lis=[i*I for i in range(10) if i%2==0]

Question: What is the difference between xrange() and range()?
Answer: both range() and xrange() shear the same properties, but the main difference occur in their return type. xrange() return the xrange object but the range return the list object.

Leave a Reply

Your email address will not be published. Required fields are marked *