Maintaining reproducible environment files: Practice Questions β Software and Environment Management (NVIDIA-Certified Associate: Accelerated Data Science)
Practice Questions: Maintaining Reproducible Environment Files These multiple-choice questions focus on maintaining reproducible environment files, a...
Practice Questions: Maintaining Reproducible Environment Files
These multiple-choice questions focus on maintaining reproducible environment files, a key skill for the NVIDIA-Certified Associate: Accelerated Data Science exam. Each question includes four options, the correct answer, and a brief explanation.
Which file format is commonly used to specify dependencies for a Conda environment to ensure reproducibility?
- A. requirements.txt
- B. environment.yml
- C. Dockerfile
- D. setup.py
Answer: B
Explanation: environment.yml is the standard YAML file used by Conda to specify packages and channels, enabling reproducible environment creation.
What is the primary purpose of freezing a Python environment using pip freeze?
- A. To install new packages
- B. To generate a list of installed packages with exact versions
- C. To update all packages to the latest version
- D. To remove unused packages
Answer: B
Explanation: pip freeze outputs all installed packages with their versions, typically saved in requirements.txt for reproducibility.
Which command creates a new Conda environment from an existing environment.yml file?
- A. conda create -n envname
- B. conda install -f environment.yml
- C. conda env create -f environment.yml
- D. conda update --file environment.yml
Answer: C
Explanation: conda env create -f environment.yml reads the YAML file and creates the environment with specified packages and versions.
Why is it important to version control environment files such as environment.yml or requirements.txt using Git?
- A. To track changes and enable collaboration on environment configurations
- B. To automatically install packages
- C. To speed up package installation
- D. To prevent package updates
Answer: A
Explanation: Version controlling environment files allows teams to track modifications, revert to previous states, and collaborate effectively on reproducible setups.
Which of the following is a best practice for ensuring reproducibility when using Docker for data science environments?
- A. Using the latest tag for all base images
- B. Specifying exact versions of base images and dependencies in the Dockerfile
- C. Avoiding Dockerfiles and using only Conda environments
- D. Installing packages interactively inside running containers
Answer: B
Explanation: Specifying exact versions in Dockerfiles ensures consistent builds and reproducible environments across different systems.
What is the function of the git add command in the context of managing environment files?
- A. To delete environment files from the repository
- B. To stage environment files for the next commit
- C. To create a new branch for environment files
- D. To merge environment files from another branch
Answer: B
Explanation: git add stages changes to environment files so they can be included in the next commit, enabling version tracking.
When exporting a Conda environment to share with others, which command is used to generate a reproducible environment file?
- A. conda export envname
- B. conda env export > environment.yml
- C. conda list --export
- D. conda save envname
Answer: B
Explanation: conda env export > environment.yml exports the active environmentβs configuration including package versions and channels to a YAML file.
Which file is typically used to specify Python package dependencies for pip and is essential for reproducibility?
- A. environment.yml
- B. requirements.txt
- C. Dockerfile
- D. setup.cfg
Answer: B
Explanation: requirements.txt lists Python packages and their versions for pip to install, supporting reproducible Python environments.
More in this topic
Preparing for the NCA-ADS exam?
Start free with 5 practice quizzes a day and track your progress.
Practise NCA-ADS questions free →