Top Python Interview Questions

Mobiprep handbooks are free downloadable placement preparation resources that can help you ace any company placement process. We have curated a list of the 40 most important MCQ questions which are asked in most companies such as Infosys, TCS, Wipro, Accenture, etc. The placement handbooks also have detailed explanations for every question ensuring you revise all the questions with detailed answers and explanations.

Question

1

Explanation

What is python?

Python is a high-level scripting language which can be used for a wide variety of text processing, system administration and internet-related tasks.
Unlike many similar languages, it’s core language is very small and easy to master, while allowing the addition of modules to perform a virtually limitless variety tasks.
Python is a true object-oriented language, and is available on a wide variety of platforms.

Question

2

Explanation

What do you mean by python modules?

Modules: Python module can be defined as a python program file which contains a python code including python functions, class, or variables.
In other words, we can say that our python code file saved with the extension (.py) is treated as the module. We may have a runnable code inside the python module. A module in Python provides us the flexibility to organize the code in a logical way.
To use the functionality of one module into another, we must have to import the specific module.
Syntax:
import <module-name>
Every module has its own functions, those can be accessed with . (dot)

Question

3

Explanation

What will be the output when we use / and // for division?

/ – divides the number and display the quotient in floating point
// – divides the number and display the quotient in integers

Question

4

Explanation

What is PYTHONPATH?

It is an environment variable which is used when a module is imported. Whenever a module is imported, PYTHONPATH is also looked up to check for the presence of the imported modules in various directories.
The interpreter uses it to determine which module to load.