Chapter 4 Quiz: Setting Up Your Vibe Coding Environment

Test your understanding of the concepts covered in Chapter 4. Each question has one best answer. Try to answer each question before revealing the solution.


Question 1

What is the minimum Python version required for the vibe coding environment described in this book?

  • A) Python 3.8
  • B) Python 3.9
  • C) Python 3.10
  • D) Python 3.12
Show Answer **C) Python 3.10** Python 3.10 is the minimum version because it includes important features like structural pattern matching and improved error messages. While Python 3.12 is recommended, 3.10 is the minimum acceptable version.

Question 2

On Windows, what critical checkbox must be selected during Python installation?

  • A) "Install for all users"
  • B) "Add python.exe to PATH"
  • C) "Install pip"
  • D) "Create desktop shortcut"
Show Answer **B) "Add python.exe to PATH"** Without this checkbox, Python installs correctly but the terminal cannot find the `python` command. The symptom is the error "'python' is not recognized as an internal or external command."

Question 3

What runtime must be installed before Claude Code can be installed?

  • A) Java
  • B) Python
  • C) Ruby
  • D) Node.js
Show Answer **D) Node.js** Claude Code is distributed as an npm package, which requires Node.js 18 or later to be installed. The installation command is `npm install -g @anthropic-ai/claude-code`.

Question 4

What is the correct command to install Claude Code globally?

  • A) pip install claude-code
  • B) npm install -g @anthropic-ai/claude-code
  • C) brew install claude-code
  • D) apt install claude-code
Show Answer **B) `npm install -g @anthropic-ai/claude-code`** Claude Code is an npm package published by Anthropic. The `-g` flag installs it globally so it can be used from any directory.

Question 5

Which environment variable stores the Anthropic API key?

  • A) CLAUDE_API_KEY
  • B) ANTHROPIC_KEY
  • C) ANTHROPIC_API_KEY
  • D) CLAUDE_CODE_KEY
Show Answer **C) `ANTHROPIC_API_KEY`** The standard environment variable name is `ANTHROPIC_API_KEY`. Claude Code looks for this variable to authenticate with the Anthropic API.

Question 6

What is the difference between a terminal and a shell?

  • A) They are the same thing
  • B) A terminal is the window application; a shell is the command interpreter running inside it
  • C) A shell is the window application; a terminal is the command interpreter
  • D) A terminal is for Windows; a shell is for macOS
Show Answer **B) A terminal is the window application; a shell is the command interpreter running inside it** The terminal (or terminal emulator) provides the graphical window. The shell (Bash, Zsh, PowerShell) is the program that interprets your typed commands. You can change which shell runs inside your terminal.

Question 7

What is the default shell on macOS Catalina and later?

  • A) Bash
  • B) Zsh
  • C) Fish
  • D) PowerShell
Show Answer **B) Zsh** Apple switched the default shell from Bash to Zsh starting with macOS Catalina (10.15). Zsh is largely compatible with Bash but includes additional features like better tab completion and themes.

Question 8

What command creates a Python virtual environment?

  • A) python3 -m virtualenv .venv
  • B) python3 -m venv .venv
  • C) python3 --create-venv .venv
  • D) pip install venv .venv
Show Answer **B) `python3 -m venv .venv`** The `venv` module is built into Python 3.3+ and is the standard way to create virtual environments. The `.venv` argument is the name of the directory to create.

Question 9

How do you activate a virtual environment on macOS/Linux?

  • A) activate .venv
  • B) .venv/activate
  • C) source .venv/bin/activate
  • D) python3 -m venv activate
Show Answer **C) `source .venv/bin/activate`** The `source` command executes the `activate` script in the current shell. On Windows PowerShell, the command is `.venv\Scripts\Activate.ps1`.

Question 10

What does the command pip freeze > requirements.txt do?

  • A) Installs packages from a requirements file
  • B) Deletes all installed packages
  • C) Lists all installed packages and writes them to a file with version numbers
  • D) Freezes the virtual environment so no more packages can be installed
Show Answer **C) Lists all installed packages and writes them to a file with version numbers** `pip freeze` outputs a list of all installed packages with their exact versions (e.g., `requests==2.31.0`). The `>` redirects this output to a file. This file can then be used with `pip install -r requirements.txt` to recreate the same environment.

Question 11

Why should you never commit a .env file to Git?

  • A) It is too large
  • B) It contains secrets like API keys that should not be shared
  • C) Git cannot track text files
  • D) It would overwrite other users' environment variables
Show Answer **B) It contains secrets like API keys that should not be shared** `.env` files typically contain API keys, passwords, and other sensitive information. Committing them to Git means anyone with access to the repository (including public repositories) can see your secrets. Use `.gitignore` to prevent committing `.env` files, and provide a `.env.example` template instead.

Question 12

What is the purpose of a .gitignore file?

  • A) To list files that Git should track
  • B) To list files and directories that Git should NOT track
  • C) To configure Git's behavior
  • D) To store Git credentials
Show Answer **B) To list files and directories that Git should NOT track** A `.gitignore` file tells Git which files and directories to ignore when tracking changes. Common entries include `.venv/`, `.env`, `__pycache__/`, and `*.pyc`.

Question 13

Which VS Code keyboard shortcut opens the integrated terminal?

  • A) Ctrl+T / Cmd+T
  • B) Ctrl+Shift+P / Cmd+Shift+P
  • C) Ctrl+` / Cmd+`
  • D) Ctrl+N / Cmd+N
Show Answer **C) `` Ctrl+` `` / `` Cmd+` ``** The backtick key combined with Ctrl (or Cmd on macOS) toggles the integrated terminal panel. This is one of the most-used shortcuts in vibe coding because you frequently switch between editing code and running commands.

Question 14

What does the which command do (or where on Windows CMD)?

  • A) Lists all installed programs
  • B) Shows which directory a command's executable is located in
  • C) Searches for text inside files
  • D) Shows which user is logged in
Show Answer **B) Shows which directory a command's executable is located in** Running `which python3` shows the full path to the Python executable your shell will use. This is invaluable for troubleshooting when the wrong version of a tool is being used.

Question 15

What Git command sets your name for commit messages?

  • A) git set user.name "Your Name"
  • B) git config --global user.name "Your Name"
  • C) git name "Your Name"
  • D) git user --name "Your Name"
Show Answer **B) `git config --global user.name "Your Name"`** The `git config --global` command sets configuration values that apply to all repositories on your machine. The `user.name` and `user.email` settings are required for making commits.

Question 16

In Cursor, what keyboard shortcut opens the inline edit feature?

  • A) Ctrl+L / Cmd+L
  • B) Ctrl+K / Cmd+K
  • C) Ctrl+I / Cmd+I
  • D) Ctrl+E / Cmd+E
Show Answer **B) `Ctrl+K` / `Cmd+K`** `Ctrl+K` / `Cmd+K` opens the inline edit feature in Cursor. Select code, press this shortcut, type your instruction, and Cursor will modify the selected code in place. `Ctrl+L` opens the chat panel, and `Ctrl+I` opens the Composer for multi-file edits.

Question 17

What Python package is used to load environment variables from a .env file?

  • A) os-env
  • B) env-loader
  • C) python-dotenv
  • D) dotfile
Show Answer **C) `python-dotenv`** The `python-dotenv` package provides the `load_dotenv()` function that reads a `.env` file and sets the variables as environment variables accessible via `os.getenv()`.

Question 18

Why is it recommended to use python3 instead of python on macOS?

  • A) python3 runs faster
  • B) macOS historically reserved python for the system Python 2
  • C) python does not work on macOS
  • D) python3 has more features than python
Show Answer **B) macOS historically reserved `python` for the system Python 2** Older versions of macOS shipped with Python 2 as `python` and Python 3 as `python3`. While newer macOS versions may not include Python 2, the convention of using `python3` persists to avoid ambiguity.

Question 19

What does the deactivate command do?

  • A) Uninstalls the virtual environment
  • B) Exits the virtual environment, returning to the global Python
  • C) Deletes all installed packages
  • D) Shuts down the terminal
Show Answer **B) Exits the virtual environment, returning to the global Python** The `deactivate` command reverses the PATH changes made by `source .venv/bin/activate`, so subsequent `python` and `pip` commands use the global installation instead of the virtual environment.

Question 20

What is the recommended approach when npm install -g fails with a permission error on macOS/Linux?

  • A) Run the command with sudo
  • B) Configure npm to use a directory in your home folder
  • C) Uninstall npm and reinstall
  • D) Switch to Windows
Show Answer **B) Configure npm to use a directory in your home folder** Using `sudo npm install -g` can create permission problems later. Instead, configure npm to install global packages in a user-owned directory:
mkdir -p ~/.npm-global
npm config set prefix '~/.npm-global'
Then add `~/.npm-global/bin` to your PATH.

Question 21

Which of the following should NOT be committed to a Git repository?

  • A) requirements.txt
  • B) .gitignore
  • C) .env
  • D) README.md
Show Answer **C) `.env`** The `.env` file contains sensitive information like API keys. It should be listed in `.gitignore` to prevent accidental commits. A `.env.example` file (with placeholder values) should be committed instead to show other developers which variables they need to set.

Question 22

What is the correct order for setting up a new vibe coding project?

  • A) Create venv, install packages, init Git, create directory
  • B) Create directory, init Git, create venv, install packages
  • C) Init Git, create directory, install packages, create venv
  • D) Install packages, create directory, create venv, init Git
Show Answer **B) Create directory, init Git, create venv, install packages** The recommended order is: (1) create the project directory, (2) initialize Git so version control starts from the very beginning, (3) create a virtual environment for isolated dependencies, and (4) install the packages you need. This ensures Git tracks the project from its inception and the virtual environment is project-specific.

Question 23

What does the editor.formatOnSave VS Code setting do?

  • A) Saves the file automatically when you stop typing
  • B) Formats your code according to style rules every time you save
  • C) Creates a backup of the file before saving
  • D) Compresses the file when saving
Show Answer **B) Formats your code according to style rules every time you save** This setting is especially valuable in vibe coding because AI-generated code sometimes has inconsistent formatting. Auto-formatting on save keeps your code clean and consistent without manual effort.

Question 24

What are tokens in the context of AI coding tools?

  • A) Authentication credentials for API access
  • B) The basic units of text that AI models process, roughly corresponding to words or word fragments
  • C) Points earned for using AI tools
  • D) Temporary files created during AI processing
Show Answer **B) The basic units of text that AI models process, roughly corresponding to words or word fragments** AI models process text as tokens rather than characters or words. A token might be a word, part of a word, or a punctuation mark. AI API costs are typically calculated based on the number of input and output tokens.

Question 25

What is the primary reason AI coding tools require an internet connection?

  • A) To download updates
  • B) To sync files across devices
  • C) The AI models run on remote servers, not on your local machine
  • D) To verify your software license
Show Answer **C) The AI models run on remote servers, not on your local machine** AI coding tools like Claude Code, Copilot, and Cursor send your prompts to cloud-based AI models and receive responses back over the internet. Your computer does not run the AI locally, which is why a stable internet connection is more important than raw processing power.

Scoring Guide

Score Rating Recommendation
23-25 Excellent You have a thorough understanding of the setup process. Proceed to Chapter 5.
19-22 Good Review the sections for any questions you missed, then move on.
15-18 Fair Re-read the relevant sections and redo the hands-on setup steps before continuing.
Below 15 Needs Review Work through the chapter again, following each step on your own computer. The hands-on practice is essential.