CompTIA Linux+ XK0-006 (V8) Practice Question

You are writing a Python 3 utility that adds user accounts to hundreds of Linux servers. The script already works, but you now need to extend it so that it (1) hashes passwords with the bcrypt algorithm and (2) writes a YAML-formatted inventory file for an Ansible playbook. Both capabilities are provided by third-party libraries available on PyPI (bcrypt and PyYAML). Concerning how Python modules and packages should be brought into your project on a typical Linux workstation, which of the following statements is correct?

  • Because Python imports modules only from the directory that contains the running script, you must place the bcrypt and PyYAML folders next to your .py file or they will not load.

  • Create and activate a virtual environment for the project, then run pip install bcrypt PyYAML; the packages are placed in the environment's site-packages directory, isolated from the system Python and installable without root.

  • External packages cannot be imported until you recompile the Python interpreter with a --with-modules flag that statically links each library.

  • Manually copy the bcrypt and PyYAML source trees into /usr/lib/pythonX.Y so the interpreter can find them when the script runs.

CompTIA Linux+ XK0-006 (V8)
Automation, Orchestration, and Scripting
Your Score:
Settings & Objectives
Random Mixed
Questions are selected randomly from all chosen topics, with a preference for those you haven’t seen before. You may see several questions from the same objective or domain in a row.
Rotate by Objective
Questions cycle through each objective or domain in turn, helping you avoid long streaks of questions from the same area. You may see some repeat questions, but the distribution will be more balanced across topics.

Check or uncheck an objective to set which questions you will receive.

Bash, the Crucial Exams Chat Bot
AI Bot