Courseiva

CCNA Claude Code Configuration and Workflows Questions

44 questions · Claude Code Configuration and Workflows · All types, answers revealed

1
MCQmedium

During a long refactoring session, a developer realizes Claude Code has been operating with an outdated understanding of a utility module because the file was changed on disk by a teammate's branch merge. The developer wants Claude to re-read the current contents of that file before continuing. Which action accomplishes this most directly?

A.Use the /clear command to reset the session
B.Run the /compact command
C.Restart the Claude Code CLI process
D.Reference the file with the @ symbol in a new prompt
AnswerD

Prefixing a path with @ in a prompt instructs Claude Code to read the current file contents from disk and include them in the context. This refreshes the model's view of that specific module without discarding the rest of the session, which is exactly what the developer needs.

Why this answer

Using the @ reference in a prompt causes Claude Code to read the named file's current contents from disk and inject them into the conversation, updating the model's view without losing session context. Clearing or restarting discards valuable history, and compacting only summarizes dialogue rather than re-reading files.

Exam trap

The trap here is reaching for session-reset commands to fix a stale file view, when a targeted @ file reference refreshes just that file while preserving context.

2
MCQhard

Which mechanism does Claude Code use to maintain session state across multiple prompts during a single refactoring task?

A.It keeps a long-running TCP connection open to the server.
B.It saves the full conversation history to a local SQLite database.
C.It manages conversation history in memory and sends it with each request.
D.It uses a global state variable on the Anthropic API servers.
AnswerC

By keeping the conversation history in the CLI's memory, the client can append new turns and tool outputs to the existing context. Sending this history with each request allows the model to maintain continuity, reference previous actions, and understand the progression of the task without requiring a stateful server.

Why this answer

Claude Code utilizes a stateless API connection, but the CLI maintains session state by managing a conversation history that is passed back to the model with every request. This history includes previous turns, tool outputs, and file modifications. This approach ensures that the model remains aware of previous decisions and code changes, allowing it to perform multi-step refactoring tasks logically and coherently while minimizing unnecessary re-computation of the base context.

Exam trap

Candidates mistakenly believe the API itself maintains persistent server-side sessions, confusing stateless API endpoints with the CLI tool's local conversation history management approach.

3
MCQmedium

A developer is using Claude Code to refactor a large TypeScript repository. They notice that Claude Code is attempting to read and analyze thousands of generated log files in the /dist folder, slowing down performance. Which configuration change should the developer make to optimize this workflow?

A.Run the command with the --no-search flag permanently.
B.Set the CLAUDE_MAX_TOKENS environment variable to a lower value.
C.Add 'dist/' to the .claudeignore file in the repository root.
D.Use the --exclude-files flag during every terminal session.
AnswerC

The .claudeignore file functions similarly to .gitignore, allowing users to define patterns for files or folders that Claude Code should ignore. Adding 'dist/' ensures the agent skips these generated artifacts entirely, significantly improving performance by focusing the model's indexing and analysis on relevant source files only.

Why this answer

To optimize Claude Code's performance, developers must effectively manage the context window and search scope. By configuring the .claudeignore file, users explicitly instruct the tool to skip non-essential directories like /dist. This ensures that the model focuses its attention only on relevant source code, reducing latency, improving accuracy, and preventing token exhaustion during complex refactoring tasks, which is critical for large-scale enterprise development projects.

Exam trap

Candidates often try to modify global model parameters to ignore files, forgetting that repository-specific exclusion files control workspace scanning.

4
MCQeasy

A developer frequently runs the same multi-step task in Claude Code: lint the changed files, run the unit tests, and then draft a commit message. They want to invoke this entire sequence with a single reusable command rather than retyping the instructions each time. Which Claude Code feature should they configure?

A.An entry in the permissions.allow array of settings.json
B.A custom slash command defined as a Markdown file in .claude/commands/
C.A Git alias in .git/config
D.A shell script added to the PATH
AnswerB

Custom slash commands are Markdown files stored in .claude/commands/ (project) or ~/.claude/commands/ (personal) whose body becomes the prompt sent to Claude. Naming the file, for example lint-test-commit.md, creates a /lint-test-commit command, giving the developer a single reusable invocation for the whole workflow.

Why this answer

Custom slash commands are the documented Claude Code mechanism for packaging a reusable prompt as a Markdown file under .claude/commands/. Invoking the command sends the file's contents as the prompt, so a single command can drive linting, testing, and commit message drafting. Git aliases, shell scripts, and permission entries operate outside the model and cannot orchestrate that workflow.

Exam trap

The trap here is treating any reusable automation (Git alias, shell script) as equivalent to a Claude Code slash command, when only the latter feeds instructions to the model.

5
MCQmedium

A developer wants Claude Code to always run the project's formatter after it edits a file, and wants this behavior shared with the whole team through version control. Which configuration mechanism is intended for this kind of automatic, tool-triggered action?

A.A descriptive paragraph in `CLAUDE.md` instructing Claude to format files after editing them.
B.A `postinstall` script in `package.json` that runs the formatter once when dependencies are installed.
C.A shell alias in each developer's profile that wraps the Claude Code invocation.
D.A hook defined in the project settings that fires after file edits and invokes the formatter.
AnswerD

Hooks are the designed extension point for deterministic, event-driven actions such as running a formatter after an edit. Because they can be declared in the committed project settings, every teammate gets the same behavior without manual setup. This matches both requirements: automatic execution and team-wide sharing through version control.

Why this answer

The requirement is an automatic action bound to a lifecycle event, shared through version control. Hooks exist for exactly this: they are configured declaratively, can live in the committed project settings, and execute deterministically when the matching event occurs. Memory text only nudges behavior, shell aliases are local and event-blind, and package install scripts fire at the wrong time.

Only the hook satisfies both the automatic and the team-shared criteria.

Exam trap

The trap here is assuming that a written instruction in memory will reliably produce an automatic action, when memory text is advisory and no lifecycle event actually triggers it.

6
MCQmedium

A developer wants a single Claude Code slash command available only to their own user account on a shared Linux workstation, not to other engineers who log into the same machine. Where should the command's Markdown file be stored?

A.In the project's .claude/commands directory at the repository root
B.In a CLAUDE.md file committed at the repository root
C.In the settings.json file under the project's .claude directory
D.In ~/.claude/commands in the developer's home directory
AnswerD

Personal slash commands live under the user-level ~/.claude/commands folder, so they load for that OS account only and are never committed to the repository. On a shared workstation, other engineers logging in under their own accounts use their own home directories, so they cannot see or invoke this command, which satisfies the isolation requirement.

Why this answer

Slash commands are Markdown files discovered from command directories, and scope follows location: files under the user's home .claude/commands are personal, while files under the project's .claude/commands are shared through the repository. To keep a command visible only to one developer on a multi-user workstation, it must be stored in that developer's home directory command folder rather than in any project-level location.

Exam trap

The trap here is assuming that any file placed under a .claude directory behaves the same, when user-level and project-level command directories deliberately differ in visibility and version control.

7
MCQeasy

A new engineer joins a team and clones the project repository. They run Claude Code and find it already follows the team's conventions for commit messages and test layout without any personal setup. Which explanation accounts for this?

A.The repository includes a project memory file that Claude Code loads automatically as context for sessions in that project.
B.The engineer's global user settings were synchronized from a shared team profile during installation.
C.Claude Code ships with built-in defaults that match most enterprise conventions out of the box.
D.Claude Code infers the team's conventions by analyzing recent commit history at session start.
AnswerA

A project memory file committed to the repository is picked up automatically whenever Claude Code runs in that directory, so conventions travel with the code. That is why a fresh clone behaves as if it were configured, with no per-developer action required. This matches the observed behavior exactly.

Why this answer

Behavior that appears automatically in a fresh clone, with no personal configuration, points to content that is committed alongside the code and loaded as session context. A project memory file does precisely that: it is read automatically for sessions rooted in that repository and carries team conventions to every developer. Commit-history inference, synchronized user profiles, and generic built-in defaults all fail to explain consistent, team-specific behavior.

Exam trap

The trap here is attributing team-specific behavior to built-in defaults or history analysis, when only committed project context can carry a specific team's conventions to a new clone.

8
MCQmedium

Refer to the exhibit. A developer is experiencing slow response times during complex refactoring tasks. Based on the provided configuration, what is the most likely cause of performance issues?

A.The temperature of 0.2 is too high for code generation.
B.The model version is experimental and suffers from high latency.
C.The max_tokens setting is causing extended generation times.
D.The configuration is missing the system_prompt field.
AnswerC

Requesting a very large max_tokens limit forces the model to potentially generate long outputs. In the context of coding, excessive generation without proper modularization increases latency. By lowering this limit, the developer can encourage the agent to produce more concise, targeted responses, improving overall tool responsiveness during complex tasks.

Why this answer

The configured max_tokens value of 8192 is significantly high, which directly impacts the latency of the API responses. During complex refactoring, if the model attempts to generate very long sequences, the time-to-first-token and total generation time increase. Reducing this value to a more constrained scope ensures faster turnaround times while still allowing sufficient room for code generation, optimizing the developer's workflow during iterative coding sessions.

Exam trap

Candidates often blame network latency or API server load, overlooking that a high max_tokens setting forces the model to generate more content, directly increasing the total request processing time.

9
MCQmedium

When Claude Code suggests a series of file edits, what is the best strategy to ensure the integrity of the project?

A.Accept all suggested changes immediately to save time.
B.Apply changes in a feature branch and perform a full test suite run.
C.Use an automated script to verify the syntax of the generated code.
D.Only use Claude Code for small, non-production helper functions.
AnswerB

Applying changes to a branch allows for a structured review process. Running the full test suite ensures that the changes do not break existing functionality. This creates a secure sandbox for validation, allowing the developer to confirm the correctness of the generated code before it enters the production codebase.

Why this answer

Treating Claude's suggestions as a draft is the safest workflow. By applying changes in a temporary branch, the developer can run tests, review the diffs, and ensure the logic is sound before finalizing the merge. This approach leverages the speed of the model for generation while maintaining the human oversight necessary for mission-critical code, preventing potential issues caused by subtle hallucinations or logic errors in the generated output.

Exam trap

Candidates often assume that code generated by Claude is completely bug-free and commit changes directly to the main branch without running test suites.

10
Multi-Selecthard

An architect is standardizing Claude Code usage across a large engineering organization. They want to ensure that every developer's sessions automatically inherit a curated set of project conventions and that destructive shell commands are blocked unless explicitly approved. Which TWO configurations should the architect implement? (Choose two.)

Select 2 answers
A.Instruct each developer to run /config and manually set the desired conventions on first launch
B.Enable auto-approval for all Bash commands to reduce interruptions during long sessions
C.Commit a CLAUDE.md file at the repository root containing the shared coding conventions and architectural notes
D.Place convention notes in a README.md and expect Claude to infer them from repository files
E.Add deny rules for destructive commands such as rm -rf to the project's .claude/settings.json permissions block
AnswersC, E

A committed CLAUDE.md at the repository root is read automatically by Claude Code at session start for every developer who clones the repo, delivering shared conventions without individual setup. It is the documented project memory mechanism and the correct vehicle for durable, team-wide natural-language guidance.

Why this answer

A committed CLAUDE.md at the repository root distributes shared conventions automatically to every session, and deny rules in the project's .claude/settings.json enforce hard blocks on destructive commands organization-wide. Manual per-developer setup and README-based expectations lack reliability and auditability, while blanket Bash auto-approval undermines the safety objective.

Exam trap

The trap here is assuming documentation in a README or manual per-developer configuration provides the same automatic, enforceable coverage as committed project memory plus structured permission rules.

11
MCQmedium

A developer working in a monorepo wants Claude Code to follow the team's TypeScript conventions only when editing files under the `packages/api` directory, while letting other directories use different conventions. What is the most appropriate way to configure this in Claude Code?

A.Create a `CLAUDE.md` file inside `packages/api` containing the TypeScript conventions so Claude Code applies those instructions when working in that directory.
B.Add the TypeScript conventions to the user-level `~/.claude/CLAUDE.md` file so they apply globally to every project the developer opens.
C.Set the `CLAUDE_CODE_MODEL` environment variable to a model fine-tuned on the API package's conventions before starting each session.
D.Add a `settings.json` entry with a `scope` field set to `packages/api` under the project's `.claude` directory to bind conventions to that path.
AnswerA

Claude Code automatically reads `CLAUDE.md` files found in the current working directory and its subdirectories, so placing one inside `packages/api` scopes those conventions to that package. When the session touches files under that path, the nested memory file is loaded, giving directory-specific guidance without affecting other packages in the monorepo.

Why this answer

Claude Code discovers `CLAUDE.md` memory files by walking from the current directory up the tree, so a file placed inside `packages/api` is loaded exactly when the session operates there. This gives the API package its own TypeScript conventions while leaving sibling packages and the repository root untouched, matching the requirement for directory-scoped guidance.

Exam trap

The trap here is assuming that conventions must live in a single global configuration file, when Claude Code actually supports directory-scoped memory files that load based on where the session is working.

12
MCQeasy

While working in a repository, an architect wants Claude Code to explain the purpose of a specific function in a large source file without altering any code or generating new files. Which mode should be used for this task?

A.Plan mode, because it prevents edits and focuses on producing an explanation or approach
B.Auto-accept edits mode, because approvals are bypassed and analysis proceeds faster
C.A new session started with the --dangerously-skip-permissions flag
D.Default edit mode, because Claude Code will simply describe the function without touching files
AnswerA

Plan mode is designed for read-only reasoning: Claude Code analyzes the codebase and proposes explanations or plans without writing files or running mutating commands. For understanding what a function does, this gives the architect the answer while guaranteeing nothing in the repository changes, which is exactly the requested outcome.

Why this answer

Claude Code separates exploration from execution. Plan mode is the read-only posture intended for understanding code, answering questions, and outlining approaches; it will not modify files. When the goal is purely explanatory, choosing plan mode enforces the no-change requirement structurally instead of relying on the model's discretion.

Exam trap

The trap here is assuming that asking a question is enough to guarantee no edits, when only a read-only mode actually prevents file modifications.

13
MCQeasy

What is the primary purpose of the 'compact' workflow in Claude Code configuration?

A.To compress the source code on disk to save storage space.
B.To reduce the token count of the conversation history while retaining key context.
C.To minify JavaScript and CSS files automatically before deployment.
D.To encrypt the session logs before they are sent to Anthropic's servers.
AnswerB

Compaction is a context-management technique. By summarizing the dialogue and results achieved so far, the tool can 'forget' the verbose details while 'remembering' the important outcomes. This allows for much longer sessions without hitting the hard limits of the model's context window.

Why this answer

Long sessions lead to high token usage and potential model drift. The compact workflow addresses this by summarizing the history. This keeps the session focused and cost-effective, ensuring that the model doesn't become overwhelmed by the 'noise' of previous command outputs or minor conversational detours.

Exam trap

Candidates often confuse 'compact' with 'summarization for long-term storage' or 'archiving', failing to realize its immediate utility in managing token limits within a single active conversation.

14
MCQmedium

In a scenario where a project-specific .clauderc file and a global ~/.clauderc file both define a 'model' setting, which one takes precedence when Claude Code is launched from that project directory?

A.The global file always takes precedence to ensure consistency.
B.The CLI will prompt the user to choose which one to use.
C.The settings are merged, and the CLI crashes if a conflict exists.
D.The project-specific file takes precedence over the global file.
AnswerD

In the standard configuration hierarchy, local or project-level settings override global or user-level settings. This allows developers to specify a more powerful model or specific MCP servers for a particular project without affecting their default setup for simpler tasks in other directories.

Why this answer

Configuration precedence is a fundamental concept in CLI tool design that allows for both general preferences and project-specific overrides. Understanding this hierarchy ensures that architects can set broad standards at the user level while allowing individual projects to use specialized models or tools as required by their unique technical constraints.

Exam trap

Candidates frequently confuse configuration inheritance, wrongly assuming that global settings override project-specific ones in CLI tools like Claude Code.

15
MCQmedium

A platform team maintains a shared monorepo. A developer runs Claude Code and wants the tool to automatically treat every file under `/infra/terraform/` as read-only for all engineers, without relying on each person to remember a flag. Where should this restriction be declared so it applies to everyone who opens the repo?

A.In the repo's `.gitignore` by adding the `/infra/terraform/` directory.
B.In the `CLAUDE.md` memory file with a sentence asking Claude not to modify Terraform files.
C.In each engineer's `~/.claude/settings.json` with a matching deny rule.
D.In the project's `.claude/settings.json` using a `permissions.deny` rule targeting the Terraform path.
AnswerD

Project-scoped `.claude/settings.json` is committed to the repo, so every engineer inherits the same permission rules automatically. A `permissions.deny` entry with a path-scoped pattern like `Edit(/infra/terraform/**)` blocks edits to those files regardless of who runs the session, which is exactly the shared, zero-effort enforcement the team wants.

Why this answer

Shared enforcement belongs in the committed project settings file, because it is version-controlled and applied to every session opened in that repository. A deny rule scoped to the Terraform directory stops edits deterministically, independent of individual developer setup. Per-user settings, Git ignore files, and memory documents all fail to give the team a uniform, repository-level guarantee that survives onboarding and local configuration drift.

Exam trap

The trap here is assuming that any file committed to the repo — including `.gitignore` or `CLAUDE.md` — can enforce a permission boundary, when only the settings file is mechanically evaluated.

16
MCQeasy

What is the primary purpose of the 'claude_config.json' file in a local project?

A.To store API keys securely for team-wide authentication.
B.To define project-specific parameters and tool behaviors.
C.To log all interactions between the developer and Claude.
D.To replace the need for a .claudeignore file.
AnswerB

This file is designed to hold configuration that tailors the Claude Code agent to a specific project. This includes defining preferred models, setting token limits, and enabling or disabling specific features. This provides a repeatable and versionable way to maintain consistent agent behavior for every developer on the team.

Why this answer

The 'claude_config.json' file serves as the centralized configuration mechanism for managing how Claude Code interacts with the specific project environment. It allows developers to define persistent settings such as model preferences, token constraints, and custom tool parameters. By localizing these settings, teams ensure that all contributors benefit from the same optimized configuration, reducing the overhead of manual setup and ensuring consistent tool behavior across the development lifecycle.

Exam trap

Candidates often mistake this file for a global settings file or a security policy file, failing to realize it is specifically for project-scoped parameters that override default behaviors.

17
MCQeasy

A developer new to Claude Code wants to quickly see a list of all available slash commands in their current session. Which command should they use?

A./commands
B./list
C./help
D./menu
AnswerC

The /help command displays a list of available slash commands and their descriptions within the current Claude Code session. It is the quickest way to discover built-in and custom commands. This directly addresses the developer's need to see all available commands.

Why this answer

The /help command is the standard way to list all available slash commands and get assistance within Claude Code. It provides a comprehensive overview of both built-in and custom commands. Other suggested commands like /commands, /list, or /menu are not recognized by Claude Code and would not fulfill the developer's request.

Exam trap

The trap here is assuming that intuitive command names like /commands or /list exist, when in fact /help is the correct command.

18
MCQhard

A platform team wants Claude Code to be allowed to run only a specific set of safe Bash commands (for example, `npm test` and `git status`) without prompting, while still blocking arbitrary shell commands. They want this policy applied automatically to every developer who clones the repository. Where should they define this allowlist so it is version-controlled and enforced for the whole team?

A.In a .env file at the repository root
B.In the user's ~/.claude/settings.json file
C.In the CLAUDE.md file at the repository root
D.In the project's .claude/settings.json file committed to the repository
AnswerD

The project-scoped .claude/settings.json is checked into version control and applies to everyone working in that repository, making it the correct place for a shared permission allowlist. Claude Code reads this file automatically, so the safe Bash commands are pre-approved for all developers without individual setup.

Why this answer

Project-scoped settings live in .claude/settings.json inside the repository and are committed to version control, so every developer automatically inherits the same permission allowlist. User-scoped settings apply only locally, environment files are not parsed by Claude Code, and CLAUDE.md provides advisory context rather than enforceable permissions.

Exam trap

The trap here is conflating advisory model guidance in CLAUDE.md with enforceable permission rules, which must be declared in a structured settings file.

19
MCQmedium

A consultant is preparing a Claude Code setup for a client whose repository must never send secrets to the model. The consultant wants to block reads of `.env` files and any file under a `secrets/` directory at the tool level. Which configuration achieves this?

A.Set file permissions with `chmod 000` on `.env` and the `secrets/` directory so the assistant cannot open them.
B.Instruct the assistant in `CLAUDE.md` to never open `.env` files or anything inside `secrets/`.
C.List `.env` and `secrets/` in a `.claudeignore` file at the repository root so Claude Code skips them.
D.Add `Read(./.env)` and `Read(./secrets/**)` deny rules to the permissions block in `.claude/settings.json`.
AnswerD

The permissions block in Claude Code settings supports allow, ask, and deny rules keyed by tool and path pattern. Denying `Read` for `.env` and everything under `secrets/` prevents the assistant from reading those files at the tool layer, which is exactly the enforcement the client requires for secret protection.

Why this answer

Claude Code permission rules are evaluated by tool and path pattern, and deny rules take effect before the tool executes. Denying `Read` for `.env` and `secrets/**` in the project settings ensures the assistant cannot open those files even if a prompt asks for them, providing the tool-level enforcement the security requirement demands.

Exam trap

The trap here is treating natural-language instructions or a made-up ignore file as a security boundary, when only explicit permission deny rules enforce what Claude Code is allowed to read.

20
MCQhard

A developer wants to ensure that Claude Code automatically uses a specific set of custom instructions for every session in a particular repository, without requiring manual invocation. They want these instructions to be version-controlled and applied to all team members. Which approach should they take?

A.Create a CLAUDE.md file at the root of the repository containing the custom instructions.
B.Add the instructions to the user's global ~/.claude/CLAUDE.md file.
C.Create a .claude/instructions.json file and reference it in the project settings.
D.Set an environment variable CLAUDE_INSTRUCTIONS with the desired text.
AnswerA

CLAUDE.md at the repository root is automatically read by Claude Code at the start of every session within that project. It can contain custom instructions, guidelines, and context. Because it is part of the repository, it can be version-controlled and shared with the team, ensuring consistent behavior across all members.

Why this answer

Placing a CLAUDE.md file at the repository root is the standard way to provide project-wide custom instructions that are automatically loaded by Claude Code. It is version-controlled, ensuring all team members benefit from the same guidance. Other methods like global user files or environment variables do not meet the requirement of being repository-specific and shared.

Exam trap

The trap here is assuming that global user settings or environment variables can serve as a substitute for project-level, version-controlled instruction files.

21
MCQmedium

You are a Claude Code user working on a Python project. You want to define a custom slash command named /test that runs your project's test suite. Where should you place the command file so that it is available only within this project?

A.In the .claude/commands/ directory at the root of the project.
B.In the ~/.claude/commands/ directory in the user's home folder.
C.In the project's .github/workflows/ directory as a YAML file.
D.In a .claude/config.json file at the project root, under a 'commands' key.
AnswerA

Placing the command file in .claude/commands/ at the project root makes the /test command available only when Claude Code is run within that project. This is the documented location for project-scoped custom slash commands, ensuring they are not exposed globally and can be version-controlled with the project.

Why this answer

Project-scoped custom slash commands must reside in the .claude/commands/ directory at the project root. This ensures the command is only available within that project and can be shared with the team via version control. User-scoped commands go in ~/.claude/commands/, but that would make the command available everywhere, which is not desired here.

Exam trap

The trap here is confusing project-scoped and user-scoped command directories, assuming that any commands folder works regardless of location.

22
MCQhard

How does Claude Code handle large repositories that exceed the standard context window size during initial indexing?

A.It uploads the entire repository to a vector database and uses RAG for every query.
B.It truncates the repository and only indexes the first 500 files detected.
C.It creates a local index of file names and symbols to enable targeted file reading.
D.It requires the user to manually specify which directories to index using the /index command.
AnswerC

Claude Code builds a local index that helps it navigate the codebase efficiently. When a user asks a question, the tool can search this index to identify which files are most likely to contain the answer. It then uses its 'read_file' tool to bring only the necessary code into the context.

Why this answer

Claude Code employs a sophisticated indexing strategy to handle repositories that are too large to fit entirely into a single prompt. It uses a combination of file metadata, symbol extraction, and selective loading to provide the model with a map of the codebase without needing every byte of code simultaneously.

Exam trap

Candidates often assume the model loads every file in the repo into memory, which would exceed context windows; they miss that the system uses selective, targeted retrieval.

23
Multi-Selecthard

A team is configuring Claude Code for a new project. They want to enforce specific tool permissions to prevent Claude Code from executing potentially dangerous shell commands without approval. Which two configuration approaches should they use? (Choose two.)

Select 2 answers
A.Define allowed and disallowed tools in the project's .claude/settings.json file.
B.Add a .claudeignore file listing tools to exclude.
C.Configure tool permissions in the user's global ~/.claude/settings.json file.
D.Set the CLAUDE_TOOL_POLICY environment variable to 'restricted'.
E.Use the /permissions command during a session to interactively adjust tool access.
AnswersA, C

The .claude/settings.json file in a project can specify tool permissions, including which tools are allowed or disallowed. By configuring this file, the team can restrict Claude Code from using certain tools, such as shell execution, without approval. This is a project-scoped, version-controlled method to enforce permissions consistently.

Why this answer

Tool permissions in Claude Code are configured via settings.json files, either at the project level (.claude/settings.json) or user level (~/.claude/settings.json). Project settings allow team-wide enforcement and can be version-controlled. Global settings provide a fallback but are user-specific.

Together, they can restrict tools like shell execution. Interactive commands and environment variables are not persistent configuration methods.

Exam trap

The trap here is confusing file exclusion mechanisms like .claudeignore with tool permission controls, or assuming interactive commands persist across sessions.

24
MCQmedium

An engineer repeatedly types the same multi-step instruction: run the unit tests, then fix any failing assertions, then re-run the suite until it passes. They want to invoke this reliably with a short, memorable name in Claude Code. What should they create?

A.A hook configured in settings.json that fires before every tool call
B.A custom slash command defined as a Markdown file containing the instruction
C.An MCP server that exposes the testing workflow as a tool
D.A new entry in the CLAUDE.md memory file describing the testing preference
AnswerB

Custom slash commands are Markdown files whose body becomes the prompt, and they are invoked by name with a leading slash. Saving the test-fix-rerun instruction as a command file gives the engineer a short, memorable trigger that reliably replays the same workflow, and the file can live in a user or project command directory depending on who should share it.

Why this answer

Custom slash commands exist to capture frequently repeated prompts behind a memorable name. A Markdown command file stores the exact instruction text, and invoking the command by its filename replays that workflow consistently. This is lighter and more predictable than hooks or memory files, and far simpler than standing up an MCP server for a prompt the engineer already writes by hand.

Exam trap

The trap here is conflating mechanisms that influence or automate behavior with the one designed for user-invoked, named prompts.

25
MCQmedium

A developer wants Claude Code to automatically run the project's linter after every file edit, but only for files inside the `src/` directory. Where should this be configured so the behavior applies to all contributors of the repository?

A.In a `.claude/settings.local.json` file with a `PostToolUse` hook that runs the linter unconditionally.
B.In the user-level `~/.claude/settings.json` using a `permissions.allow` rule that lists the linter binary.
C.In a project-scoped `.claude/settings.json` file using a `hooks` entry with a `PostToolUse` matcher for the Edit and Write tools.
D.In the top-level `CLAUDE.md` file with a natural-language instruction telling Claude to run the linter after edits.
AnswerC

Project-scoped `.claude/settings.json` is committed to the repository, so every contributor inherits the same configuration. A `hooks` block with a `PostToolUse` matcher scoped to the Edit and Write tools fires the linter command after each file modification, and the hook command itself can filter to paths under `src/` before invoking the linter.

Why this answer

A repository-committed `.claude/settings.json` is the only location that both propagates to every contributor and supports deterministic hook execution. Pairing a `PostToolUse` hook with a matcher for the Edit and Write tools ensures the linter fires exactly after file mutations, and the hook command can restrict itself to `src/` paths, satisfying every stated constraint in the scenario.

Exam trap

The trap here is assuming that a natural-language instruction in CLAUDE.md or a permissions allow-rule is equivalent to a deterministic hook, when only hooks guarantee the command actually executes.

26
MCQmedium

When troubleshooting an issue where Claude Code is failing to suggest relevant file modifications, which workflow step should be performed first?

A.Reinstall the Claude Code CLI tool globally.
B.Verify the current project index and refresh if necessary.
C.Change the model to a higher-intelligence version.
D.Clear the local browser cache and cookies.
AnswerB

Indexing is the core mechanism enabling Claude Code to understand a codebase. If the index is outdated, the model cannot reference new files or changes effectively. Verifying and refreshing the index is the most logical first step to resolve discrepancies between the current filesystem and the agent's knowledge.

Why this answer

The first step in troubleshooting context-retrieval issues is to verify the indexing state of the project. Claude Code relies on its internal index to 'see' the codebase. If the index is stale or failed to build correctly, the model will lack the necessary information.

Checking the status or force-refreshing the index ensures that the agent is working with the most current representation of the project structure and file contents.

Exam trap

Candidates often assume Claude Code automatically syncs with real-time file system changes or jump straight into debugging the model's logic without checking if the underlying project index is stale or missing.

27
Multi-Selecthard

A security-conscious architect is standardizing how Claude Code is configured across a large engineering organization. Which TWO practices best reduce the risk introduced by project-level configuration that arrives with cloned repositories? (Choose two.)

Select 2 answers
A.Store credentials and API keys directly in the project settings file so every session authenticates consistently.
B.Use enterprise-managed policy settings to constrain what project-level configuration is permitted to do.
C.Ask developers to disable all hooks globally on their machines.
D.Require review of committed configuration and hook definitions before a repository is trusted in developer environments.
E.Rely on the model to refuse to run any command that looks dangerous, without additional configuration.
AnswersB, D

Managed policy sits above project and user scope, so it can restrict or forbid risky capabilities even when a repository ships aggressive configuration. This gives the organization a durable backstop that does not depend on every developer inspecting every clone, which is what makes it effective at scale.

Why this answer

The risk is that cloning a repository imports configuration capable of executing commands. The two complementary controls are inspection and constraint: review what a project declares before trusting it, and use managed policy to cap what project scope can do regardless of its contents. Blanket hook bans remove useful capability without targeting the threat, storing secrets in shared files worsens exposure, and depending solely on model judgment leaves no enforceable boundary.

Exam trap

The trap here is believing that the model's built-in caution about dangerous commands is a sufficient control, when configuration-driven execution happens outside that judgment.

28
MCQmedium

How should a team handle multiple developers using Claude Code on the same shared repository?

A.Have each developer maintain their own local configuration file.
B.Commit project-specific Claude configuration files to the repository.
C.Disable the use of local configuration files for all team members.
D.Assign one lead developer to configure Claude for the team.
AnswerB

Committing configuration files ensures that the settings used by Claude Code are consistent for all contributors. It enables the team to maintain a unified policy regarding which files are indexed or how the tool behaves, promoting stability and predictability across the team's shared development environment and workflow.

Why this answer

Standardizing the project configuration through version-controlled files like .claudeignore and .claude_config ensures consistent tool behavior across the team. By treating these files as part of the codebase, teams align the agent's behavior with their specific workflows and security policies. This prevents fragmented experiences and ensures that every team member benefits from the same optimized settings, reducing friction and maintaining project-wide consistency in how the tool is utilized.

Exam trap

Candidates often suggest that each developer maintain their own local settings, which leads to configuration drift and inconsistent agent behavior across the team's shared codebase.

29
MCQeasy

A new engineer on a team wants to see every slash command currently available in their Claude Code session, including custom commands the team has added, before starting a large refactor. Which action should they take?

A.Run `claude --list-commands` from the shell before launching the interactive session.
B.Open the `~/.claude/commands` directory and read every Markdown file to reconstruct the command list manually.
C.Type `/help` at the prompt to display the list of available slash commands, including custom ones.
D.Press `Ctrl+R` to open the command history and infer the available commands from prior sessions.
AnswerC

The `/help` slash command in Claude Code prints the built-in commands along with any custom commands the project or user has defined. It is the standard way to discover what is available in the current session, making it the right first step before a large refactor where the engineer wants to know which shortcuts exist.

Why this answer

Claude Code exposes slash-command discovery through `/help`, which lists both built-in commands and any custom commands defined for the project or user. Because the engineer needs a complete, current view before starting a refactor, invoking `/help` inside the session is the direct and authoritative way to get that list.

Exam trap

The trap here is assuming a shell-level flag or filesystem inspection replaces the in-session discovery command, when Claude Code centralizes command listing behind the `/help` slash command.

30
Multi-Selecthard

A team wants to optimize their Claude Code workflow for a large monorepo. Which TWO of the following actions improve performance and context relevance?

Select 2 answers
A.Increase the max_tokens limit to account for the large codebase.
B.Use .claudeignore to exclude build artifacts and node_modules.
C.Always set temperature to 1.0 to maximize creativity in code.
D.Restrict Claude Code to specific sub-directories when working on tasks.
E.Enable verbose logging to monitor every token sent to the API.
AnswersB, D

Excluding large, non-source directories like node_modules or build artifacts is essential for monorepos. This reduces the time taken to build the context index and prevents the model from being distracted by generated code, ensuring that Claude focuses strictly on the developer-authored source files, which improves response quality.

Why this answer

Efficient monorepo management requires reducing the noise within the context window. By using a .claudeignore file, you prevent the agent from parsing irrelevant configuration or binary files. Additionally, focusing the working directory or using selective indexing ensures that the model operates only on the relevant sub-projects.

These strategies significantly reduce token usage and improve the latency of context-aware operations, leading to a much more responsive developer experience.

Exam trap

Candidates often suggest indexing the entire repository to ensure 'full context', which is the opposite of what is needed for large monorepo performance optimization.

31
MCQhard

An architect is onboarding a legacy service and wants Claude Code to build context quickly. The repository has 40,000 files, most of them generated build artifacts and vendored dependencies, and the team wants exploration to stay focused on first-party source. Which approach best keeps Claude Code's automatic context gathering efficient here?

A.Add ignore patterns for the generated and vendored directories in the project's ignore configuration so they are excluded from tool-driven discovery.
B.Delete the generated and vendored directories from the working copy before starting the session.
C.Paste the full directory tree into the first prompt so Claude has a complete map of the repository.
D.Run the session from inside the `src/` subdirectory so the working root is smaller.
AnswerA

Claude Code respects ignore configuration when deciding which files to surface during search and exploration. Excluding build artifacts and vendored code keeps discovery pointed at first-party source, which lowers noise and token cost on a large repository. This is the targeted fix for a repo where most files are irrelevant to the task at hand.

Why this answer

On very large repositories, the dominant cost is irrelevant files entering the model's discovery path. Ignore configuration is the supported, reversible lever: it filters generated and vendored content out of search and exploration while leaving first-party source fully reachable. Dumping a tree into the prompt, shrinking the working root, or deleting directories all either waste context, over-restrict scope, or cause collateral damage.

Exam trap

The trap here is treating a smaller working directory as equivalent to ignore configuration, when the two differ in whether legitimate first-party files outside that directory remain reachable.

32
Multi-Selecthard

Which TWO of the following practices should be implemented to ensure Claude Code operates securely within a production-adjacent environment?

Select 2 answers
A.Grant Claude Code full sudo permissions to debug system-level issues.
B.Use custom instructions to explicitly forbid 'rm -rf' or database deletion commands.
C.Enable 'auto-approve' for all shell command executions to speed up workflows.
D.Require human confirmation for all terminal commands that modify the filesystem.
E.Hardcode the Anthropic API key into the project's config file for convenience.
AnswersB, D

Custom instructions provide a safety layer by defining behavioral constraints for the agent. Explicitly forbidding dangerous commands prevents the model from attempting destructive operations during refactoring or cleanup tasks. This acts as a guardrail, significantly reducing the blast radius of potential mistakes or misinterpreted user intent.

Why this answer

Security in AI-assisted coding requires a defense-in-depth approach. By enforcing the principle of least privilege through custom instructions and strictly auditing shell execution commands, architects can mitigate risks associated with autonomous code generation. These practices protect against inadvertent destructive actions and ensure that the agent remains within defined operational boundaries, which is essential for maintaining the integrity of production-adjacent environments.

Exam trap

Candidates frequently rely solely on system-level permissions or assume the model understands safety intuitively, failing to explicitly implement hard constraints like human-in-the-loop confirmation for destructive commands.

33
MCQhard

Which of the following describes the correct relationship between Claude Code's indexing process and the file system?

A.The index is refreshed in real-time for every single file write operation.
B.The index is a static snapshot taken only when the tool starts.
C.The index maps file content and structure to enable efficient retrieval.
D.The index is sent to Anthropic servers for processing and storage.
AnswerC

The index serves as a search index for the project's codebase. It maps the structure and content of the files into a format that the model can query efficiently. This enables the agent to locate relevant information across large projects without loading every file into the context window.

Why this answer

Claude Code's indexing process is reactive and incremental. It scans the filesystem to build a semantic map of the codebase, which is stored locally. This index allows for efficient retrieval of relevant information without needing to re-scan the entire project every time a prompt is submitted.

By understanding this relationship, developers can better manage their projects, knowing that changes to the filesystem are eventually reconciled into the index to maintain context accuracy.

Exam trap

Candidates often mistake the index for a 'cache' of the entire file content, rather than a semantic map used for efficient retrieval and navigation.

34
MCQeasy

Which command is used to start a new Claude Code session in the current directory and begin indexing the local files?

A.claude init
B.claude start
C.claude
D.claude session --new
AnswerC

Running the 'claude' command in the terminal launches the interactive agent. It immediately checks the current directory for a repository, reads any configuration files, and prepares the indexing service so that the model can answer questions about the code right away. This simplicity is a core feature of the tool's design.

Why this answer

Starting a session is the first step in the Claude Code workflow. The CLI command initializes the environment, scans the directory for relevant files, and establishes a connection to the Anthropic API. This process allows the model to understand the codebase context before the user begins asking questions or requesting edits.

Exam trap

Candidates often look for overly complex initialization commands like 'claude init' or 'claude start', failing to recognize the simplicity of the base 'claude' command.

35
MCQmedium

A developer is working on a legacy monorepo where the Claude Code CLI's auto-generated commit messages keep mixing unrelated changes from multiple microservices. To improve this, the developer wants Claude Code to read a project-specific file that describes the commit message format and scope conventions. Which file should the developer create at the repository root to provide this persistent, team-shared guidance?

A.commitlint.config.js
B.settings.json
C..gitmessage
D.CLAUDE.md
AnswerD

CLAUDE.md is the project memory file that Claude Code automatically reads at session start, making it ideal for team-shared conventions like commit message formats and scope rules. Placing it at the repository root ensures every developer on the team gets the same guidance without manual configuration.

Why this answer

CLAUDE.md is the documented project memory mechanism that Claude Code reads automatically at the start of every session, making it the correct place for repository-wide conventions such as commit message formats and scope naming. Tool-specific config files and Git templates are not consumed as model context.

Exam trap

The trap here is assuming any file with 'config' or 'commit' in its name will be read by Claude Code, when only CLAUDE.md and its documented variants serve as project memory.

36
MCQmedium

Refer to the exhibit. A developer sees this error log in the terminal output. What is the most likely cause of this failure in the Claude Code workflow?

A.The developer does not have write permissions for the file 'src/auth.ts'.
B.The model is attempting to edit a file that has been excluded by .claudeignore.
C.The model's context for 'src/auth.ts' is outdated or incorrect.
D.The 'edit_file' tool has been disabled in the project's .claude.json configuration.
AnswerC

The error 'old_string not found' occurs when the model tries to replace a block of code that doesn't exactly match what is on the disk. This happens if the file changed since Claude last read it. The correct workflow is for the model to re-read the file to synchronize its state.

Why this answer

The 'edit_file' tool works by performing a search-and-replace operation. If the model's internal representation of the file is out of sync with the actual contents on disk, the operation will fail. This often happens if the file was modified by an external process or if the model's previous 'read' was incomplete.

Exam trap

Developers often assume the model has real-time file system awareness, forgetting that failed edits usually stem from stale context or desynchronized file states.

37
MCQmedium

A developer wants to use Claude Code to perform a large refactor across multiple files. What is the most efficient workflow to ensure the model has the necessary context without manual file-by-file reading?

A.Manually run 'cat' on every file in the project and paste the output into the prompt.
B.Use the /read-all command to force Claude to load every file into memory at once.
C.Provide a high-level description of the refactor and let the model use its search and read tools.
D.Copy the entire project into a single .txt file and upload it using the /upload command.
AnswerC

The most effective way to work with Claude Code is to leverage its agentic nature. By describing the goal (e.g., 'Refactor the Auth module to use the new DB schema'), the model can use its search tools to find relevant files and then selectively read and edit them as needed.

Why this answer

Efficiency in large-scale refactoring depends on the model's ability to discover and navigate the codebase. Rather than the user manually feeding files to the model, the best practice is to describe the scope of the change and allow the model to use its internal tools to explore the relevant dependencies.

Exam trap

Developers often waste context and time by manually feeding every relevant file to the model instead of leveraging autonomous tool discovery.

38
MCQmedium

An engineering team wants to customize Claude Code behavior across their enterprise repository by enforcing specific project-level guidelines and system prompts. Where should the lead architect place these configuration directives so that Claude Code automatically detects and applies them upon initialization in the workspace root?

A.Inside a .claude/config.json file in the user home directory
B.Within the package.json file under a dedicated claudeConfig key
C.Inside a CLAUDE.md file located directly in the repository root directory
D.As environment variables defined inside a local .env file
AnswerC

CLAUDE.md in the repository root is automatically read and injected as project context when Claude Code initialises in that workspace, so guidelines and system prompts apply without manual invocation. This satisfies the requirement for automatic detection at the workspace root.

Why this answer

Placing configuration guidelines in the CLAUDE.md file within the workspace root allows Claude Code to automatically load custom project instructions, codebase conventions, and behavioral constraints during startup. This mechanism ensures consistent AI assistance tailored precisely to the specific engineering practices and architectural patterns utilized across the development team's codebase.

Exam trap

Many test-takers mistakenly believe that custom enterprise settings must be injected via external API configuration payloads rather than repository files.

39
MCQmedium

An architect is onboarding a new developer to a repository that uses Claude Code. The developer wants to understand how the tool determines which project-specific instructions to load automatically at the start of a session. The repository already contains a CLAUDE.md file at the root. What is the correct behavior of Claude Code regarding this file?

A.Claude Code only reads CLAUDE.md if it is referenced inside a .claude/settings.json configuration file.
B.Claude Code ignores CLAUDE.md unless the developer explicitly runs a command to import it at the beginning of each session.
C.Claude Code treats CLAUDE.md as a scratchpad that is only written to and never read as context during a session.
D.Claude Code automatically reads the CLAUDE.md file from the project root and includes its contents as context for the session.
AnswerD

CLAUDE.md is the designated project memory file. When Claude Code starts in a directory containing this file, it automatically loads the content into the context window, giving the model project-specific guidance without any manual action. This is the intended mechanism for sharing architecture notes, coding conventions, and workflow instructions across a team.

Why this answer

The CLAUDE.md file at the project root is automatically ingested as context when Claude Code starts in that directory, which is how teams distribute conventions and architectural notes. No manual import or settings.json entry is required, and the file is not merely a write-only scratchpad. This automatic loading is what makes project memory reliable across sessions.

Exam trap

The trap here is assuming that project memory requires an explicit import command or a settings.json reference, when Claude Code actually discovers and loads CLAUDE.md by convention at session start.

40
Multi-Selecthard

An architect is onboarding a large team to Claude Code and wants to standardize how project-level configuration is shared through version control so that every developer gets the same behavior. Which two practices should the architect adopt? (Choose two.)

Select 2 answers
A.Commit a `.claude/settings.json` file to the repository so shared permissions, hooks, and environment settings are consistent for everyone who clones it.
B.Commit each developer's `~/.claude/settings.json` into the repository so personal preferences travel with the code.
C.Store API keys and other credentials in the committed `.claude/settings.json` so all developers authenticate identically.
D.Commit a `.claude/commands` directory containing custom slash commands so the whole team can reuse the same parameterized prompts.
E.Have each developer run `claude config set --global` with the team's preferred values during onboarding instead of committing configuration files.
AnswersA, D

Project-level settings live in `.claude/settings.json` and are designed to be checked into version control, so every developer inherits the same permissions, hooks, and environment configuration. Committing this file is the canonical way to standardize behavior across a team and keep it auditable alongside the code it governs.

Why this answer

Project-scoped configuration belongs in the repository so it is versioned and shared. Committing `.claude/settings.json` standardizes permissions, hooks, and environment behavior, while committing `.claude/commands` distributes reusable slash commands. Together they give every developer identical Claude Code behavior on clone, which is the goal of the onboarding standardization effort.

Exam trap

The trap here is mixing personal, user-level configuration or secrets into the repository, when only project-scoped settings and command definitions are meant to be shared through version control.

41
MCQhard

A platform team wants Claude Code to automatically run the project's formatter after every file edit made by the assistant, so that generated code always matches the repository style without manual intervention. Which configuration should the team use?

A.Define a `PostToolUse` hook in `.claude/settings.json` that matches the file-editing tool and invokes the formatter command.
B.Set the `CLAUDE_CODE_AUTO_FORMAT` environment variable to `true` in the shell profile before launching Claude Code.
C.Create a custom slash command named `/format` and instruct developers to run it after each assistant edit.
D.Add the formatter invocation to the `CLAUDE.md` memory file as an instruction the assistant should follow after each edit.
AnswerA

Hooks in Claude Code settings can be bound to lifecycle events such as `PostToolUse`, which fires after a tool call completes. By matching the file-editing tool and running the formatter, the team ensures formatting happens automatically after each edit, exactly matching the requirement for consistent style without manual steps.

Why this answer

Claude Code hooks are configured in settings files and bind shell commands to lifecycle events. A `PostToolUse` hook that matches the file-editing tool and runs the formatter guarantees the formatter executes after each edit, which is the deterministic behavior the platform team wants for repository-wide style consistency.

Exam trap

The trap here is believing that instructions in a memory file or a manually invoked slash command enforce automatic post-edit behavior, when only hooks provide deterministic execution tied to tool events.

42
MCQmedium

During an interactive session, Claude Code identifies a bug and proposes a fix that requires executing a shell command to install a new dependency. How does the default permission model handle this request?

A.Claude Code automatically executes the command if it is deemed safe by the internal classifier.
B.The tool prompts the user for manual approval before executing any shell command.
C.The command is blocked unless the user has pre-authorized the specific package manager in config.
D.Claude Code executes the command silently and only reports the output if an error occurs.
AnswerB

Manual approval is the standard security gate for shell execution in Claude Code. This workflow ensures that developers can review the exact command, understand its implications, and verify its correctness before it runs. It strikes a balance between agentic productivity and the necessity of human-in-the-loop security verification.

Why this answer

Claude Code is designed with a safety-first approach that requires explicit user consent for actions that can modify the system state. By prompting the user for approval before executing shell commands, the tool ensures that the human operator remains in control of the environment and can prevent potentially destructive actions.

Exam trap

Candidates often assume that because the agent is 'autonomous', it has full, unchecked permission to execute system commands, forgetting the built-in safety requirement for human confirmation.

43
MCQmedium

A developer needs to integrate a third-party tool that provides real-time logs to Claude Code. Which configuration section in the .clauderc file is responsible for defining these external integrations?

A.external_tools
B.plugins
C.mcpServers
D.log_connectors
AnswerC

The mcpServers section is the correct location for defining external tool connections using the Model Context Protocol. This section specifies how the CLI should start or connect to servers that provide the model with additional capabilities, such as reading logs or accessing specialized databases during development.

Why this answer

Claude Code utilizes the Model Context Protocol (MCP) to interact with external tools and services, expanding its functionality beyond simple text generation. Properly defining these in the configuration file allows the model to access specialized data or perform actions in external environments, which is essential for complex debugging or integration tasks.

Exam trap

Candidates often confuse configuration blocks for model hyperparameters with integration keys, searching under generic settings instead of protocol-specific sections.

44
MCQhard

A platform team maintains a repository where a committed .claude/settings.json grants broad Bash permissions, but an engineer needs a stricter personal policy that still allows the shared project settings for everything else. Which approach correctly applies the engineer's narrower permission policy?

A.Create a CLAUDE.md file containing the permission rules as natural-language instructions
B.Add the narrower rules to .claude/settings.local.json in the repository working tree
C.Edit the committed .claude/settings.json to remove the broad permissions, then commit the change
D.Set the CLAUDE_CODE_PERMISSIONS environment variable in the shell profile to override the project file
AnswerB

Claude Code supports a local settings file, .claude/settings.local.json, which is intended for personal overrides and is normally excluded from version control. Placing the engineer's stricter permission rules there layers the personal policy over the committed project settings without changing what teammates receive, exactly matching the requirement to stay stricter while keeping shared configuration intact.

Why this answer

Claude Code merges settings from multiple scopes, and the local settings file exists precisely for per-developer overrides that should not be committed. Writing stricter permission rules into .claude/settings.local.json lets the engineer tighten their own environment while the committed project settings continue to apply for shared concerns, achieving a personal policy without disturbing teammates or the repository.

Exam trap

The trap here is treating the committed project settings file as the only place permissions can live, when a dedicated local settings file is designed for exactly this kind of personal narrowing.

Ready to test yourself?

Try a timed practice session using only Claude Code Configuration and Workflows questions.