QuizzesVirtual Environments & pip — Isolating Every Project — Concept Check
intermediate
python

Virtual Environments & pip — Isolating Every Project — Concept Check

Questions on Virtual Environments & pip — Isolating Every Project. python -m venv .venv gives each project its own interpreter and packages; pip installs into it; requirements.txt with pinned versions makes the setup reproducible on any machine.

8 minutes 8 questions Pass at 70%
Time Limit
8 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

8 questions on Virtual Environments & pip — Isolating Every Project — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.A developer notices that after installing a package globally, another project starts failing. What is the most likely cause?

    • AThe global installation overwrote a package version needed by the other project.
    • BThe global installation corrupted the Python interpreter.
    • CThe global installation removed the other project's dependencies.
    • DThe global installation caused a syntax error in the other project's code.
  2. 2.You clone a Python project and see a (.venv) prefix in the terminal prompt. What does this indicate?

    • AThe virtual environment is deactivated.
    • BThe virtual environment is activated for this project.
    • CThe project is using a global Python interpreter.
    • DThe project is using a deprecated Python version.
  3. 3.A team member commits the .venv folder to the repository. What problem might this cause?

    • AIt prevents others from creating their own virtual environments.
    • BIt ensures everyone uses the same environment.
    • CIt bloats the repository with unnecessary files.
    • DIt speeds up the CI/CD pipeline by reusing the environment.
  4. 4.After creating a virtual environment and activating it, a developer runs pip install requests. Where is the package installed?

    • AIn the system's Python library.
    • BInside the project's .venv folder.
    • CGlobally, affecting all projects.
    • DIn a temporary cache directory.
  5. 5.You notice two projects using different Django versions. How can you manage this without conflicts?

    • AUse a single virtual environment for both projects.
    • BUse separate virtual environments for each project.
    • CManually edit the Python interpreter for each project.
    • DInstall both versions globally and switch as needed.
  6. 6.A developer claims that pip freeze automatically upgrades all packages to their latest versions. What is the truth?

    • Apip freeze lists current package versions; it doesn't upgrade them.
    • Bpip freeze upgrades packages before listing them.
    • Cpip freeze only lists outdated packages.
    • Dpip freeze deletes old package versions.
  7. 7.Why is it important to pin versions in requirements.txt for applications?

    • ATo allow flexibility in package updates.
    • BTo ensure reproducible installs across different environments.
    • CTo automate dependency resolution.
    • DTo reduce the size of the virtual environment.
  8. 8.A developer uses pip install --upgrade fastapi but forgets to update requirements.txt. What issue might this cause?

    • AThe environment becomes inconsistent with the documented setup.
    • BThe environment is rolled back to the previous version.
    • CThe upgrade fails and fastapi is uninstalled.
    • DThe upgrade is automatically reflected in requirements.txt.