# Quiz — Session 6: Claude Code & CI/CD

**Program:** Applied AI — Advanced Level — Instructor: Yann Isola
**Format:** 10 MCQs (multiple choice questionnaire) — only one correct answer per question — recommended duration: 12 minutes.
**Level:** certification depth *Claude Certified Architect* — several questions are judging scenarios.

---

**Q1. What fundamentally distinguishes Claude Code from a chat assistant that talks about code?**

- A. It uses a larger model, specialized in programming
- B. It is an agent: it loops — reads files, modifies, executes commands, observes the results and corrects — within a perimeter of permissions defined by the user
- C. It works entirely offline, without calling the model
- D. It can only work on one file at a time

**Q2. What is the role of the `CLAUDE.md` file?**

- A. This is the log of past conversations with Claude Code
- B. This is the tool permissions configuration file
- C. This is a project instruction file loaded automatically at the start of each session: overview, conventions, common commands, known pitfalls
- D. This is the file where Claude Code writes its plans before executing them

**Q3. The command `/init` of Claude Code…**

- A. Resets all permissions to their default values
- B. Inspects the repository and generates a first draft of `CLAUDE.md`, which the team must then rework
- C. Initializes a new empty Git repository
- D. Clears the context of the current conversation

**Q4. In `.claude/settings.json`, the entry `"Bash(npm test:*)"` in the list `allow` means:**

- A. All shell commands are allowed if npm is installed
- B. Orders starting with `npm test` are allowed without confirmation; other orders `Bash` remain subject to the normal regime (confirmation, or headless refusal)
- C. The command `npm test` is prohibited
- D. Claude Code will launch `npm test` automatically after each change

**Q5. Scenario: a CI pipeline uses Claude Code in headless mode for PR review (reading the diff, producing a comment). What set of permissions should an architect use?**

- A. All authorized tools, to avoid blockages in the middle of the night
- B. `Read`, `Glob`, `Grep`, `LS`, plus variants `Bash(git diff:*)`/`Bash(git log:*)` — and nothing else: no writing, no `WebFetch`, no free shell
- C. Only `Write`, to write the review comment
- D. `Bash` without restriction, because the CI is already an isolated environment

**Q6. What is the difference in nature between a rule written in `CLAUDE.md` and a hook `PreToolCall`?**

- A. None: both guarantee the same level of control
- B. The `CLAUDE.md` is more reliable because it is read every session
- C. The prompt instruction is probabilistic (the model almost always follows it); the hook is deterministic (code that runs every time and can block the call) — security requirements go into hooks or permissions
- D. Hooks only work in headless mode, `CLAUDE.md` only in interactive mode

**Q7. The team wants every file modified by Claude Code to be immediately reformatted by the in-house formatter, without exception. What mechanism?**

- A. A bold statement in `CLAUDE.md`
- B. A hook `PreToolCall` which blocks all edits
- C.A filtered `PostToolCall` hook on editing tools (`Edit`, `MultiEdit`, `Write`), which launches the formatter after each modification
- D. A hook `Stop` which reformats the entire repository at the end of the session

**Q8. In headless mode (`claude -p "..."`), what happens when Claude Code wants to use a tool not authorized by the configuration?**

- A. A confirmation window is displayed on the CI runner
- B. The tool is automatically authorized after 30 seconds without response
- C. The action is refused — there is no one to confirm — and the task may remain incomplete: hence the need to pre-calibrate the permissions to what is strictly necessary for the task
- D. Claude Code automatically switches to interactive mode

**Q9. Scenario: a test generation CI job has `Write` and runs on a runner containing deployment secrets. The analyzed PR comes from an external contributor. What is the main risk and its priority mitigation?**

- A. No risk: the model always refuses malicious instructions
- B. Prompt injection: the PR code may contain hidden instructions that the agent will read; mitigation: minimal permissions (limit `Write`, no network tools, no free shell), safeguard hooks, and isolation of the runner from secrets
- C. API quota overrun, which is resolved by increasing the timeout
- D. The slowness of the model, which we solve with a faster model

**Q10. What are `/compact` and `/cost` used respectively in a long interactive session?**

- A. `/compact` reduces the size of project files; `/cost` displays the subscription price
- B. `/compact` compresses conversation history (summary) to free context and maintain quality; `/cost` displays the consumption of tokens and the cost of the session — two reflexes for controlling long sessions, supplemented by prompt caching which charges stable prefixes at a reduced rate ⚠ (rate: see today's price list)
- C. `/compact` merge Git commits; `/cost` estimates development time saved
- D. Both commands are only available in headless mode

---

## Fixed and comments

| # | Answer | Certification comment |
|---|---|---|
| Q1 | **B** | The keyword is *agentic*: action loop → observation → correction, under permissions. |
| Q2 | **C** | `CLAUDE.md` = permanent and versioned context memory of the project. Canonical structure: overview, conventions, commands, gotchas. |
| Q3 | **B** | `/init` produces a *draft*. On the exam, be wary of answers that present automatic generation as a final deliverable. |
| Q4 | **B** | Self-acceptance reasons are by order prefix. The `deny` always wins over the `allow`. |
| Q5 | **B** | Least privilege: a magazine reads, it does not write. Each superfluous tool widens the attack surface (especially in the face of prompt injection). |
| Q6 | **C** | THE session architect distinction: persuasion (prompt) vs. capacity (permissions) vs. control (hooks). |
| Q7 | **C** | “After each change” → `PostToolCall` filtered. `Stop` (D) is too late and does not cover intermediate checks. |
| Q8 | **C** | Direct consequence of the absence of humans in the loop. Almost certain question under consideration in one form or another. |
| Q9 | **B** | Third-party content read by the agent is an injection vector.The defense is not trust in the model but reduction of the perimeter: permissions, hooks, isolation of secrets. |
| Q10 | **B** | Management of long sessions: context (`/compact`), cost visibility (`/cost`), structural economy (prompt caching). |

**Certification preparation threshold: 8/10.** Below, rework questions Q5, Q6, Q8, Q9 (architect's judgment) as a priority.