Python Mock Test

This section presents you various set of Mock Tests related to Python. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

Answer : A

Explanation

PYTHONPATH − It has a role similar to PATH. This variable tells the Python interpreter where to locate the module files imported into a program. It should include the Python source library directory and the directories containing Python source code. PYTHONPATH is sometimes preset by the Python installer.

Q 5 - Which of the following environment variable for Python contains the path of an initialization file containing Python source code?

Answer : B

Explanation

PYTHONSTARTUP − It contains the path of an initialization file containing Python source code. It is executed every time you start the interpreter. It is named as .pythonrc.py in Unix and it contains commands that load utilities or modify PYTHONPATH.

Q 6 - Which of the following environment variable for Python is used in Windows to instruct Python to find the first case-insensitive match in an import statement?