LearnFrenzy
Sign in Take a free test

Modules and Packages · Exercise 1 of 4

Modules and Packages Modules and Packages MCQ

  • 15 questions
  • Page 2 of 2
  • Answers explained
0Attempted
0Correct
0Wrong
Directions

Fifteen multiple-choice questions on Python modules and packages: import forms, sys.path and sys.modules, the __main__ guard, __init__.py, relative imports, __all__, pip and virtual environments. Pick an option to check your answer instantly.

Question 11 Medium

Which function re-executes an already-imported module?

A importlib.reload(module)
B import module again
C sys.reload(module)
D module.refresh()
Question page & discussion
Question 12 Easy

What is the main purpose of a virtual environment (python -m venv)?

A To run Python faster
B To compile Python to machine code
C To hide source code
D To give each project its own isolated set of installed packages
Question page & discussion
Question 13 Hard

Which error does from math import squareroot raise?

A ModuleNotFoundError
B ImportError – the module exists but has no such name
C NameError
D AttributeError
Question page & discussion
Question 14 Easy

After import statistics as st, which call works?

A st.mean([1, 2, 3])
B statistics.mean([1, 2, 3])
C mean([1, 2, 3])
D as.mean([1, 2, 3])
Question page & discussion
Question 15 Easy

What does pip install -r requirements.txt do?

A Creates a virtual environment
B Lists the installed packages
C Uninstalls the listed packages
D Installs every package (and version) listed in the file
Question page & discussion
Up next · Exercise 2Predict the Output15 questions

Ready to test your Programming?

Timed online tests with instant scores and explanations.

Search LearnFrenzy

Esc

Quick links