NEW
Font size
WorksheetsLECTURE 07 (01.12.2025)
Total questions: 20
Worksheet time: 10mins
True or False: A virtual environment helps keep your project’s packages separate from other projects.
True
False
Which command do you use to add files to the Git staging area?
git commit
git add
git push
git pull
True or False: The Git staging area is where your changes wait before you save them to the project history.
True
False
Which Python module lets you read environment variables?
sys
os
math
json
True or False: The command git pull sends your changes to the remote repository.
True
False
Which command makes a new virtual environment in Python?
python -m venv myenv
pip install myenv
git init myenv
python create myenv
Why do we use a virtual environment?
To make code run faster
To keep project packages separate
To use more RAM
To connect to the internet
Which Git command saves the changes from the staging area to your project history?
git add
git commit
git push
git clone
What is the correct way to read an environment variable called DB_PASSWORD in Python?
password = os.getenv('DB_PASSWORD')
password = getenv('DB_PASSWORD')
password = os.environ('DB_PASSWORD')
password = os.get('DB_PASSWORD')
True or False: Environment variables are used to store settings like passwords outside your code.
True
False
You want to get your files ready for the next Git commit. Which command do you use?
git push
git commit
git add
git checkout
If you have two Python projects and want to keep their packages separate, what should you do?
Use one global environment
Make a virtual environment for each project
Install all packages system-wide
Only use built-in modules
After you use git add, what is the next command to save your changes?
git push
git commit
git clone
git status
Which command installs all the packages listed in requirements.txt into your virtual environment?
pip install requirements.txt
pip install -r requirements.txt
python install requirements.txt
git install requirements.txt
Why should you use environment variables for things like passwords?
To make your code faster
To keep passwords out of your code
To use less memory
To make your code longer
You changed three files but only want to save one in your next Git commit. What should you do?
Use git add only on the file you want
Use git commit -a
Use git push
Use git clone
You have two Python projects that need different versions of the same package. What should you do?
Install both versions globally
Use a virtual environment for each project
Only use the latest version
Avoid using the package
Write a Python program that prints the value of the environment variable called "MY_SECRET". What is the output if you set MY_SECRET to "hello123" before running the code?
hello123
MY_SECRET
None
Error
You want to make sure your app works on another computer. What should you do with your dependencies?
Copy your site-packages folder
Use requirements.txt and pip install -r requirements.txt in a virtual environment
Only install Python
Use git clone only
Write a Python program that reads the environment variable "DB_PASSWORD" and prints "Password found" if it exists, or "No password" if it does not. What will the program print if DB_PASSWORD is not set?
Password found
No password
Error
DB_PASSWORD
