Courseiva

CCNA Claude Code Questions

32 questions · Claude Code · All types, answers revealed

1
MCQhard

Refer to the exhibit. What is the most effective way to address the agent's modification of build artifacts?

A.Accept the changes and manually delete the artifacts later.
B.Add the build artifact paths to .claudeignore and revert changes.
C.Tell the agent to be more careful next time.
D.Rebuild the project to overwrite the agent's changes.
AnswerB

Updating the .claudeignore file is the standard configuration fix for this issue. It prevents the agent from seeing or touching these files in future tasks. Reverting the changes via Git ensures the repository returns to a clean state, correcting the mistake effectively and efficiently.

Why this answer

The correct approach is to stop the agent, exclude the build artifacts via .claudeignore, and revert the changes to those specific files using Git. This protects the integrity of the build process and ensures the agent stays focused on source code. By teaching the agent to respect these boundaries, you optimize future task performance and prevent similar errors in subsequent automated refactoring steps.

Exam trap

Candidates often try to manually delete build artifacts without updating configuration. This causes the agent to recreate them, leading to a loop of unnecessary modifications and wasted compute resources.

2
MCQhard

Refer to the exhibit. How does Claude Code handle this interruption, and what is the expected outcome?

A.The agent proceeds with the original plan to ensure consistency.
B.The agent updates the plan and skips the 'test' directory.
C.The agent crashes and requires a session restart.
D.The agent asks the user to manually perform the file changes.
AnswerB

The agent acknowledges the new constraint and re-evaluates its execution plan. By dynamically filtering out the 'test' directory from its list of target files, it demonstrates its ability to incorporate user guidance in real-time, effectively mitigating the risk of inadvertent changes to critical test code.

Why this answer

Claude Code is built to handle mid-task updates to instructions. When the user provides a constraint update (like excluding a folder), the agent halts its planned execution to incorporate this new requirement into its plan. This allows for safe, interactive corrections to mass-refactoring tasks, ensuring that the developer remains in control and preventing accidental modifications to sensitive or critical parts of the codebase during large-scale operations.

Exam trap

Candidates often believe the agent will continue its original plan despite new constraints. They fail to realize the agent will halt and re-plan, which is a feature to ensure safety.

3
MCQmedium

A developer is working in a large repository and wants Claude Code to understand the project structure and available tools before making changes. They run `claude` in the project root. Which action best ensures Claude Code has the necessary context for the session?

A.Manually paste the entire directory tree into the first prompt.
B.Run `claude --verbose` to enable detailed logging of all file accesses.
C.Execute `claude --reset` to clear previous session memory and start fresh.
D.Run `/init` to generate a CLAUDE.md file that documents the project structure and common commands.
AnswerD

The `/init` command analyzes the repository and creates a CLAUDE.md file that captures key project details such as build commands, test procedures, and architectural notes. This file is automatically read by Claude Code in subsequent sessions, providing persistent context. It is the recommended first step when starting work in a new or unfamiliar codebase.

Why this answer

Using `/init` generates a CLAUDE.md file that persists across sessions and captures essential project details like build commands and architecture. This is the intended mechanism for providing durable context in a new codebase. Other options either do not exist, provide only temporary input, or do not enhance Claude Code's understanding of the project.

Exam trap

The trap here is assuming that any command-line flag or manual input can substitute for the persistent, structured context that `/init` provides.

4
MCQhard

When Claude Code executes a shell command that requires user intervention (such as an interactive prompt), how does the agent typically handle this situation?

A.It automatically guesses the correct input.
B.It terminates the process and reports an error.
C.It pauses the agent and waits for human input.
D.It forces the command with the -y or --force flag.
AnswerC

The agent pauses its autonomous execution when it detects an interactive shell prompt. This allows the developer to complete the command manually, ensuring safety and accuracy, before the agent resumes its remaining planned tasks, which is the standard, secure way to handle non-deterministic shell behavior.

Why this answer

Handling interactive shell commands is a design challenge for autonomous agents. Claude Code is built to be safe and predictable. It monitors the output of the shell and, when it detects an interactive prompt that it cannot resolve autonomously, it pauses execution and waits for the user to provide input.

This design prevents the agent from hanging indefinitely or making dangerous, unconfirmed assumptions in sensitive environments.

Exam trap

Test-takers frequently assume the agent will automatically guess answers to interactive prompts or fail with an error, overlooking its safe design to pause for humans.

5
MCQhard

A developer is using Claude Code to debug a complex issue. After several exchanges, Claude Code suggests a solution that involves modifying a configuration file outside the project directory. The developer is concerned about unintended side effects. What is the most appropriate way to handle this?

A.Accept the suggestion but create a backup of the configuration file first.
B.Use the `/undo` command to revert the suggestion and then manually edit the configuration file.
C.Allow the modification because Claude Code has context about the system.
D.Reject the suggestion and ask Claude Code to propose a solution that stays within the project directory.
AnswerD

Rejecting the suggestion and requesting an alternative that confines changes to the project directory minimizes the risk of unintended side effects. This approach keeps the solution contained and reversible. Claude Code can often find alternative approaches that do not require modifying external files, such as using project-local configuration.

Why this answer

Rejecting the suggestion and asking for a solution confined to the project directory is the safest approach. It avoids potential side effects on other projects or the system. Claude Code can often provide alternatives that use project-local configuration, which are easier to manage and revert.

Exam trap

The trap here is assuming that Claude Code's context includes system-wide implications, when its knowledge is typically limited to the project and provided context.

6
MCQhard

A developer wants to integrate Claude Code into a CI/CD pipeline. Why is this generally discouraged or difficult to achieve directly?

A.The tool is not licensed for use in CI/CD pipelines.
B.The tool is designed for interactive human sessions.
C.The tool requires an internet connection for every step.
D.It cannot execute shell commands reliably.
AnswerB

Claude Code requires a human to provide context, clarify intent, and review changes. CI/CD pipelines are inherently automated and headless. The tool's reliance on a continuous, interactive loop makes it incompatible with the rigid, script-based nature of automated deployment pipelines that require zero human intervention during execution.

Why this answer

Claude Code is primarily an interactive, human-in-the-loop tool. Its design relies on terminal input, natural language prompts, and real-time user validation, which are not conducive to non-interactive CI/CD automation. CI/CD pipelines require deterministic, automated scripts.

Attempting to force an interactive agent into such environments leads to unpredictable behavior, race conditions, and high costs, as the agent is not optimized for the standard, scripted environment of automated build and deployment systems.

Exam trap

Developers often assume that any AI tool can be effortlessly dropped into headless build scripts, forgetting that interactive CLI tools require constant human validation.

7
MCQmedium

A developer is working in a large monorepo and wants Claude Code to automatically run `npm run lint` and `npm run test` after every file edit it makes, without needing to ask each time. Which Claude Code feature should the developer configure to achieve this?

A.Configure a PostToolUse hook in `.claude/settings.json` that matches the Edit and Write tools and runs the lint and test commands.
B.Add a CLAUDE.md file at the repository root that documents the lint and test commands.
C.Enable the `--auto-approve` flag in the project's `.claude/settings.json` so Claude Code can decide when to run the commands.
D.Create a custom slash command named `/lint-test` in `.claude/commands` that runs both commands.
AnswerA

Claude Code hooks let you register shell commands that fire automatically in response to lifecycle events such as PostToolUse. By matching Edit and Write tools and pointing the hook at `npm run lint` and `npm run test`, the developer ensures those commands run deterministically after each file change, which is exactly the automated, no-prompt behavior requested here.

Why this answer

Hooks are the deterministic automation mechanism in Claude Code. A PostToolUse hook bound to the Edit and Write tools executes a configured shell command every time those tools complete, which guarantees `npm run lint` and `npm run test` run after each change without any prompt. Documentation files, slash commands, and permission flags influence behavior or require manual action but cannot enforce automatic post-edit execution.

Exam trap

The trap here is assuming that documenting commands in CLAUDE.md or creating a slash command makes them run automatically, when only a lifecycle hook actually enforces event-driven execution.

8
MCQmedium

A developer notices that Claude Code is hallucinating about the availability of a specific CLI tool that is not installed in the current environment. What is the most effective way to correct this behavior?

A.Ignore the hallucinations and hope the agent eventually realizes.
B.Open a support ticket with Anthropic to report the bug.
C.Explicitly state in the chat that the tool is unavailable.
D.Install the tool to satisfy the agent's expectation.
AnswerC

Providing direct feedback allows the agent to update its local context window with the new information. Once the agent is explicitly told that a tool is missing, it will refrain from calling it in subsequent steps, preventing repeated errors and forcing it to find alternatives.

Why this answer

Directly informing the agent about the environment's limitations is the most efficient way to resolve hallucinations. By providing explicit feedback regarding the missing tool, you help the agent update its internal model of the environment. This correction ensures the agent stops attempting to use non-existent commands, shifting its strategy toward available methods and improving the reliability of its future actions and suggestions.

Exam trap

Users often get frustrated and stop the session when the agent hallucinates a tool. They fail to realize that a simple, direct correction in the chat can resolve the issue immediately.

9
Multi-Selecthard

Which TWO of the following capabilities are native to Claude Code when operating in a repository?

Select 2 answers
A.Autonomous deployment of code to production servers.
B.Execution of shell commands to test and verify code.
C.Persistent storage of user source code on Anthropic servers.
D.Analysis and understanding of local codebase context.
E.Automatic configuration of cloud infrastructure providers.
AnswersB, D

The agent leverages the local shell environment to run tests, build projects, and verify the output of its own changes. This capability allows the AI to perform iterative debugging cycles, ensuring that modifications actually work as intended before the developer reviews the final implementation.

Why this answer

Claude Code is designed to act as an autonomous engineer within the local development environment. Its core strengths include the ability to execute shell commands to verify changes and the capacity to read the codebase to provide context-aware suggestions. Understanding these native capabilities is vital for developers to delegate tasks effectively without manually performing every verification step, thereby accelerating the software development lifecycle while maintaining code quality through automated testing.

Exam trap

Test-takers frequently select automated cloud deployments or full project management features, confusing Claude Code's local repository capabilities with general enterprise project management software.

10
MCQhard

Refer to the exhibit. You are working with Claude Code and receive this error message during a batch refactor. What is the most appropriate course of action?

A.Immediately terminate the session and restart to clear the cache.
B.Wait for the duration specified in the error message before resuming.
C.Modify the local code to reduce the number of function calls.
D.Increase the concurrency settings in the project config file.
AnswerB

Adhering to the 'retry_after' duration is the standard approach for handling rate-limiting errors. Waiting allows the API quota to reset, ensuring that subsequent requests from the agent are processed successfully without triggering further errors or potential temporary blocks on the API key being used.

Why this answer

Rate limiting is a common occurrence during high-volume API interactions. The 'retry_after' field provides clear instruction on the necessary wait time. Manually waiting or allowing the agent to handle the backoff prevents further API errors and ensures that the session remains stable.

This is crucial for maintaining the integrity of the ongoing task and avoiding potential session disconnects or state corruption during intense automated coding sessions.

Exam trap

Users often panic or attempt to force-retry immediately when hitting rate limits. This causes further API errors and potential session instability rather than allowing the system to back off gracefully.

11
MCQeasy

Which of the following is an example of an effective natural language instruction for Claude Code?

A.Fix the code.
B.Refactor the authentication module to use JWT instead of sessions, keeping existing error handling.
C.Make it better.
D.Delete everything in the src directory.
AnswerB

This prompt is excellent because it defines the scope (authentication module), the task (JWT implementation), and the constraint (maintain error handling). This specificity allows the model to reason effectively and produce a focused, high-quality solution that aligns with the developer's exact requirements for the refactoring task.

Why this answer

Effective prompts are clear, concise, and provide actionable goals with necessary context. By specifying the file, the intended change, and the desired outcome, a developer helps the agent narrow its focus, leading to more accurate results. This practice reduces ambiguity, minimizes the need for follow-up corrections, and maximizes the efficiency of the AI agent, which is a key skill for any developer working with modern LLM-powered CLI tools.

Exam trap

Test-takers frequently choose vague, high-level statements like 'fix my code' rather than specific architectural directions with explicit constraints and modules.

12
MCQhard

You are working in a monorepo where the repository root contains a CLAUDE.md with shared coding standards, and the packages/api directory has its own CLAUDE.md with API-specific conventions. During a session started from the repository root, Claude Code begins editing files under packages/api. Which CLAUDE.md content is applied to those edits, and how should you expect the two files to interact?

A.Neither file is applied automatically; you must paste the relevant conventions into the prompt each time you want them honored.
B.Both files contribute: the root CLAUDE.md supplies repo-wide standards while the packages/api CLAUDE.md adds directory-specific conventions that take precedence for those files.
C.Only the repository root CLAUDE.md is loaded, because Claude Code reads a single memory file at the project root and ignores nested ones.
D.The nested packages/api CLAUDE.md completely replaces the root CLAUDE.md for the whole session once any file in that directory is touched.
AnswerB

Claude Code layers project memory, so the root CLAUDE.md establishes repository-wide conventions and the nested packages/api CLAUDE.md refines them for that subtree. The more specific file governs the API edits, while the root guidance still applies where it is not overridden. This layering is exactly what lets a monorepo keep shared standards without forcing every package to repeat them.

Why this answer

Claude Code treats CLAUDE.md as layered project memory rather than a single global file. A repository-root CLAUDE.md carries standards that apply across the codebase, and a nested CLAUDE.md inside a package refines those rules for that subtree. For edits under packages/api, the nested conventions govern while the root standards still apply where they are not contradicted, which is why monorepos can share common guidance and still specialize per package.

Exam trap

The trap here is assuming memory files are mutually exclusive, so whichever CLAUDE.md is closest wins outright and the root file stops mattering.

13
MCQmedium

How does Claude Code maintain context over a long-running conversation in the terminal?

A.It stores all conversation history in the git index.
B.It keeps state in memory and local configuration.
C.It clears all history every time a command is run.
D.It relies entirely on the terminal scrollback buffer.
AnswerB

By maintaining state in active memory and persisting necessary context to local hidden files, the agent ensures continuity between turns. This approach allows the model to recall previous decisions, file modifications, and user instructions, enabling a seamless multi-turn workflow without losing track of the ongoing project state.

Why this answer

Claude Code utilizes a stateful management system that tracks the conversation history, recent file changes, and the current project state. This allows the model to reference previous suggestions, understand the current file structure, and build upon earlier tasks, which is critical for consistent, multi-turn interactions. By managing this context effectively, the tool provides a cohesive experience that mimics a human pair programmer, ensuring that the agent remains helpful throughout complex, multi-stage development projects.

Exam trap

Candidates tend to think context is stored solely in remote vector databases or cloud servers, missing the local state management mechanism of the terminal session.

14
MCQhard

A developer wants Claude Code to understand the team's API conventions, directory layout, and preferred testing framework for a specific service, and wants that guidance loaded automatically at the start of every session in that repository without typing it. What is the most appropriate way to accomplish this?

A.Add the conventions as comments in a source file that Claude Code is likely to read during the session.
B.Create a `.claude/settings.json` entry with a `systemPrompt` field containing the conventions.
C.Place a CLAUDE.md file in the repository root containing the conventions, layout notes, and testing framework guidance.
D.Paste the conventions into the first message of each session before asking for changes.
AnswerC

CLAUDE.md is the project memory file that Claude Code reads automatically when a session starts in that directory. Putting API conventions, directory layout, and testing framework notes there ensures every session begins with that context already loaded, matching the requirement precisely. It is the documented mechanism for persistent, repository-scoped instructions without manual repetition.

Why this answer

CLAUDE.md is the designated project memory file. Claude Code automatically reads it at the start of a session in the repository, so conventions, layout notes, and testing framework preferences placed there are available without manual effort. Manual pasting, unsupported settings fields, and scattered code comments cannot deliver the same consistent, automatic, repository-wide context loading that the developer needs.

Exam trap

The trap here is assuming a settings.json field can inject project instructions, when persistent project guidance belongs in CLAUDE.md and settings.json only controls behavior like permissions and hooks.

15
MCQmedium

When should a developer choose to 'reject' an edit suggested by Claude Code?

A.Whenever the suggested change is more than ten lines.
B.When the changes introduce logical or security errors.
C.Only when the code fails to compile.
D.Every time the model uses a library the user dislikes.
AnswerB

Ensuring the code is logical and secure is the developer's primary responsibility. If the agent proposes code that fails testing, introduces vulnerabilities, or misunderstands business logic, the developer must reject the change to prevent the introduction of technical debt or critical bugs into the codebase.

Why this answer

Rejecting an edit is an essential part of the human-in-the-loop workflow. A developer should reject a suggestion if it violates architectural patterns, introduces security risks, fails to satisfy business requirements, or incorrectly interprets the codebase. Exercising this judgment ensures the quality of the project and prevents the AI from propagating errors, reinforcing the developer's role as the final authority on code quality and system architecture in the development lifecycle.

Exam trap

Candidates often think rejection is only for 'broken' code. They fail to realize that architectural misalignment or security concerns are equally valid reasons to reject an agent's suggestion.

16
MCQmedium

A developer wants Claude Code to remember a project-specific convention: all new database migration files must be placed in the `db/migrations` directory and named with a `YYYYMMDDHHMMSS_` prefix. The developer wants this rule applied automatically in every future Claude Code session for this repository, without having to repeat the instruction each time. What is the most appropriate way to achieve this?

A.Add the convention to a CLAUDE.md file at the repository root.
B.Run `claude config set migration.dir db/migrations` before each session.
C.Create a `.claudeignore` file listing `db/migrations` to protect the directory.
D.Paste the convention into the first message of every new session.
AnswerA

CLAUDE.md at the repository root is automatically loaded into context at the start of every Claude Code session in that repository, making it the correct place for persistent project conventions. It requires no per-session action and is version-controlled alongside the code, so all developers and all future sessions inherit the rule consistently.

Why this answer

Persistent, repository-scoped instructions belong in CLAUDE.md, which Claude Code reads automatically at session start. That file can be committed so every developer and every future session inherits the naming and placement rule without manual repetition. Ad-hoc pasting or non-existent config keys do not satisfy the requirement of automatic, durable application across sessions.

Exam trap

The trap here is assuming there is a dedicated config command for every project convention, when the supported mechanism for durable project instructions is the CLAUDE.md memory file.

17
Multi-Selecthard

A developer wants Claude Code to run a series of shell commands as part of a build task but is concerned about the assistant executing arbitrary or destructive commands. Which TWO practices reduce this risk while still allowing the needed commands to run? (Choose two.)

Select 2 answers
A.Add a PreToolUse hook on the Bash tool that inspects the command and blocks anything outside the approved set.
B.Instruct Claude Code in CLAUDE.md to never run dangerous commands.
C.Run the build inside a container with no network access and a read-only filesystem.
D.Enable `--dangerously-skip-permissions` to avoid prompts during the build.
E.Define an allow list in `.claude/settings.json` that permits only the specific build commands the task requires.
AnswersA, E

A PreToolUse hook can examine the proposed Bash command and reject it before execution, providing a programmatic guardrail beyond static allow lists. This lets the developer enforce custom rules, such as rejecting commands containing destructive flags, while still permitting the build commands. It is a flexible way to reduce risk during shell execution without removing the ability to run what is needed.

Why this answer

Least-privilege controls are the right answer. An allow list in settings.json restricts execution to the specific build commands, and a PreToolUse hook on the Bash tool can inspect and block disallowed commands before they run. Together they permit the intended build while constraining arbitrary or destructive execution.

Skipping permissions removes safeguards, memory-file advice is not enforced, and container hardening changes the environment rather than governing command selection.

Exam trap

The trap here is treating a written instruction in CLAUDE.md as a security control, when only enforced mechanisms like allow lists and hooks actually restrict which commands can execute.

18
MCQeasy

A developer wants Claude Code to add input validation to a specific function in `src/api/users.py`. Which instruction is most likely to produce a correct, targeted change?

A.Check all the inputs everywhere and fix anything that looks wrong.
B.In `src/api/users.py`, add validation to the `create_user` function that rejects requests where `email` is missing or lacks an `@` character, and return a 400 with a clear message.
C.Make the code better.
D.Add a TODO comment in the users module about validation.
AnswerB

This instruction names the file, the function, the exact fields and conditions to validate, and the desired response behavior. That specificity lets Claude Code make a minimal, verifiable change without wandering into other files. It also establishes testable acceptance criteria, so the developer can immediately confirm the edit matches intent.

Why this answer

Targeted instructions that specify file, function, validation rules, and expected error behavior produce minimal, verifiable edits. Claude Code performs best when the scope and acceptance criteria are explicit, because it can act confidently without guessing. Vague, unbounded, or purely documentary prompts either miss the goal or create unnecessary churn across the repository.

Exam trap

The trap here is assuming any prompt mentioning validation will do, when the decisive factor is naming the exact file, function, conditions, and expected response.

19
MCQmedium

What role do 'project-aware' features play in Claude Code during a development session?

A.They allow the agent to automatically commit changes to Git.
B.They enable the agent to understand existing project conventions.
C.They force the agent to only use the most popular libraries.
D.They prevent the agent from accessing external online resources.
AnswerB

Project-awareness is the foundation for maintaining stylistic and architectural integrity. By analyzing existing patterns, the agent ensures that new code follows the established conventions of the project, which significantly reduces technical debt and ensures long-term maintainability for the team working on the codebase.

Why this answer

Project-awareness allows Claude Code to understand the structure, language conventions, and dependency relationships within the codebase. This context is crucial for generating code that is idiomatic and structurally sound. Instead of treating files as isolated units, the agent can reason about how changes in one file impact another, leading to more accurate refactoring and fewer integration issues across the entire project repository.

Exam trap

Users often treat the agent as a standalone code generator that lacks knowledge of the wider project. They fail to leverage project-awareness to ensure code style and dependency consistency.

20
MCQeasy

What is the primary purpose of the 'Claude Code' tool in a professional development environment?

A.To act as a cloud-based storage service for source code.
B.To automate the deployment of applications to production.
C.To assist with coding tasks by interacting with the local project.
D.To replace the need for version control systems like Git.
AnswerC

The primary goal of Claude Code is to act as a powerful assistant that understands the project context, navigates the file system, and executes code-related tasks. It enables developers to accelerate their workflow by automating repetitive or complex tasks while maintaining project alignment and high quality.

Why this answer

Claude Code functions as an autonomous, project-aware coding assistant designed to handle complex development tasks directly within the terminal. By integrating deeply with the codebase and local tools, it enhances developer productivity, handles repetitive tasks, and assists with complex debugging. Its professional utility lies in its ability to understand existing context, apply changes, and iterate based on feedback, bridging the gap between high-level intent and low-level code implementation.

Exam trap

Candidates often confuse Claude Code with a general-purpose chatbot. They fail to recognize its specific role as a terminal-integrated tool that directly manipulates the local project file system.

21
MCQmedium

When Claude Code is asked to perform a complex, multi-file task, how does it typically approach the problem?

A.It modifies all files simultaneously in one batch.
B.It breaks the task into logical, iterative steps.
C.It asks the developer to perform the file edits.
D.It ignores file dependencies to save time.
AnswerB

By breaking tasks into smaller steps, the agent can verify each modification. This allows it to identify issues early, manage project complexity effectively, and provide the developer with clear progress updates, ensuring that the overall goal is achieved safely and with higher accuracy than a batch-edit approach.

Why this answer

Claude Code is designed to decompose complex tasks into smaller, logical steps. It first analyzes the codebase, plans the necessary file modifications, and then executes these changes incrementally, often verifying intermediate steps through test runs. This iterative approach is crucial for managing complexity.

By breaking large tasks into digestible pieces, the agent can maintain state, identify conflicts, and ensure that each part of the refactor or implementation is correct before proceeding, reducing the risk of errors.

Exam trap

Many candidates believe the model attempts to rewrite an entire multi-file project in a single monolithic generation step, leading to high failure rates.

22
Multi-Selecthard

A developer is working on a large refactoring task with Claude Code. They want to ensure the agent has sufficient context about the project's architecture and coding standards. Which TWO of the following are recommended ways to provide this context? (Choose two.)

Select 2 answers
A.During the session, explicitly reference key files like `src/core/engine.ts` and ask Claude to read them for context.
B.Run `claude --add-context architecture.md` to load the architecture document into the session.
C.Place a `CLAUDE.md` file at the repository root with an overview of the architecture and coding conventions.
D.Include detailed comments in each source file describing the overall system design.
E.Use the `/context` command to manually upload a PDF of the architecture diagram.
AnswersA, C

Claude Code can read files on demand when prompted. By explicitly referencing important files, you direct the agent to incorporate their contents into its working context. This is useful for targeted context, especially when not all files are relevant. It complements `CLAUDE.md` for dynamic needs.

Why this answer

The recommended ways to provide project context are using a `CLAUDE.md` file at the root and explicitly referencing key files during the session. `CLAUDE.md` offers persistent, project-wide guidance, while on-demand file references allow the agent to focus on specific areas. Other options like `/context` command, `--add-context` flag, or relying solely on comments are not supported or effective.

Exam trap

The trap here is thinking that Claude Code has special commands like `/context` or `--add-context` for loading documents, when in fact `CLAUDE.md` and direct file references are the intended mechanisms.

23
MCQmedium

Why is it important to use the Claude Code CLI within an initialized Git repository?

A.It is required for the agent to connect to the internet.
B.It provides a safety net for reverting changes.
C.It automatically deploys the code to GitHub.
D.The agent refuses to work without a remote origin defined.
AnswerB

Git allows the developer to manage the changes made by the agent. By tracking the history, the developer can quickly review, verify, and rollback changes as needed. This is essential for maintaining project quality and preventing accidental regressions caused by an agent's code updates.

Why this answer

Git integration is fundamental to using Claude Code effectively. It allows the agent to track changes, easily undo mistakes, and see the 'diff' of what it has modified. This safety net encourages experimentation and allows the developer to revert changes easily if the agent's output is not what they intended, creating a professional development workflow that minimizes risk during automated code modifications.

Exam trap

Candidates might think Git is only for version control history, ignoring its crucial role as a safety net that lets automated agents rollback edits.

24
MCQeasy

What is the primary purpose of the 'claude' command-line interface tool?

A.To host a web server for displaying AI documentation.
B.To act as an autonomous agent for local code interaction.
C.To manage remote server configurations exclusively.
D.To replace the git version control system.
AnswerB

Claude Code is specifically architected as an autonomous agent capable of reading, writing, and executing code within a local environment. It functions as a partner to the developer, performing file operations and shell commands based on natural language instructions provided through the terminal interface.

Why this answer

The primary objective of the Claude Code CLI is to serve as an interactive AI agent that integrates directly into the developer's terminal. It bridges the gap between natural language intent and local file manipulation. By understanding the tool's purpose, developers can leverage it to automate repetitive coding tasks, debug issues in real-time, and maintain context across a project, significantly reducing the cognitive load involved in navigating complex codebases.

Exam trap

Many candidates confuse the CLI tool with a cloud-based API testing utility or a remote deployment dashboard rather than its actual role as an interactive local code agent.

25
MCQmedium

When Claude Code is asked to perform a complex task that might take a long time, how does the agent manage the execution flow to ensure task completion?

A.It executes the entire task as a single, atomic operation.
B.It prompts the user to verify every single line of code generated.
C.It breaks the goal into smaller, verifiable steps.
D.It pauses and requests human assistance for every file change.
AnswerC

Decomposition allows the agent to handle complex problems effectively. By isolating each step, Claude Code can validate outcomes, handle errors locally, and maintain context, which is fundamental to its ability to perform high-quality, reliable code generation and maintenance in sophisticated software projects.

Why this answer

Claude Code utilizes a sub-tasking strategy for complex requests. It breaks down large goals into smaller, manageable steps, executing them sequentially or in parallel when appropriate. This modular approach allows the agent to maintain focus, track progress across multiple files, and verify results at each step, significantly increasing the probability of successful task completion compared to attempting large, atomic changes without validation.

Exam trap

Candidates often think the agent performs large tasks as a single atomic operation. This leads to poor prompt design, as they fail to request step-by-step breakdowns for complex, multi-file refactoring tasks.

26
MCQhard

Refer to the exhibit. Claude Code has encountered a test failure while implementing a feature. How should the developer effectively guide the agent to resolve this error using the agent's internal capabilities?

A.Manually apply the fix to the code and restart the Claude Code session.
B.Instruct the agent to read the logs and apply a fix based on the stack trace.
C.Disable the agent's ability to run commands to prevent further errors.
D.Run 'npm install' to ensure all dependencies are resolved before proceeding.
AnswerB

Providing the error log as context allows Claude Code to trace the logic error back to the source. The agent can then identify the missing function definition or improper import, suggest a code modification, and execute the test suite again to verify the resolution effectively.

Why this answer

Claude Code excels at iterative debugging by leveraging its ability to read execution logs and apply fixes directly to code. The most efficient approach involves instructing the agent to analyze the stack trace, locate the undefined function call, and propose a corrective patch. This leverages the agent's autonomous capability to reason about project architecture rather than requiring manual intervention, keeping the development loop self-contained and highly efficient.

Exam trap

Developers frequently try to fix errors manually after seeing a stack trace. They miss the opportunity to have the agent analyze the logs itself, which is faster and more context-aware.

27
MCQhard

A developer is using Claude Code to refactor a function across multiple files. After a few edits, Claude Code proposes a change that would alter the behavior of a critical utility function used elsewhere. The developer wants to ensure the change is safe before applying it. What is the most appropriate action?

A.Use the `/undo` command to revert all previous edits and start the refactor from scratch.
B.Accept the change and run the full test suite afterward to catch any regressions.
C.Reject the change and ask Claude Code to propose an alternative that preserves the existing behavior.
D.Manually edit the utility function to match the proposed change and then continue.
AnswerC

Rejecting the change and requesting an alternative that maintains the original behavior ensures that the critical utility function remains stable. This approach leverages Claude Code's ability to iterate on suggestions while keeping the developer in control. It is the safest way to avoid unintended side effects in other parts of the codebase that depend on that function.

Why this answer

Rejecting the proposed change and asking for an alternative that preserves existing behavior is the safest approach when a critical utility function is involved. It keeps the developer in control and avoids unintended side effects. Other options either apply the risky change, discard too much work, or bypass the review process entirely.

Exam trap

The trap here is thinking that running tests after accepting a risky change is sufficient, when the real risk is that tests may not cover all usages of a critical function.

28
MCQhard

A team wants Claude Code to run a custom script that inspects the repository for license headers before any commit. The script must run automatically each time Claude Code is about to create a commit, and the team wants the same hook to apply to every developer without manual setup. Which mechanism should they use?

A.Ask each developer to add the script to their personal shell profile as an alias.
B.Configure a cron job on each developer machine to run the script every five minutes.
C.Add a note in CLAUDE.md instructing Claude Code to run the script before committing.
D.Define a hook in the project's Claude Code settings that triggers on the commit event and runs the script.
AnswerD

Claude Code supports hooks configured in project settings that fire on specific lifecycle events such as pre-commit, letting the team run the license-header script automatically. Because the configuration lives in the repository, every developer inherits the same behavior without individual setup, which satisfies both the automatic execution and shared-application requirements.

Why this answer

Hooks defined in project-level Claude Code settings run deterministically on lifecycle events such as pre-commit and are shared through the repository, so every developer gets identical behavior automatically. Advisory notes in CLAUDE.md and per-machine aliases or cron jobs are either non-enforcing or require individual setup, and none reliably fires at the exact moment Claude Code is about to commit.

Exam trap

The trap here is relying on CLAUDE.md instructions or shell aliases for enforcement, when only a configured hook guarantees the script runs on the commit event for every developer.

29
Multi-Selectmedium

A developer is onboarding to an unfamiliar Python service and wants to use Claude Code to build an accurate mental model of how requests flow through the codebase before making changes. Which TWO actions best leverage Claude Code for this exploration task? (Choose two.)

Select 2 answers
A.Ask Claude Code to reformat all source files with the project's linter settings.
B.Ask Claude Code to trace the request path from the HTTP route definitions through the service layer and summarize each hop.
C.Ask Claude Code to identify the entry points and describe how middleware, routing, and dependency injection are wired together.
D.Ask Claude Code to list every file in the repository sorted by line count.
E.Ask Claude Code to run the full test suite and report only the total pass and fail counts.
AnswersB, C

Claude Code can read multiple files and follow references across the repository, so asking it to trace a request path produces a synthesized explanation that would otherwise require hours of manual navigation. This directly serves the goal of understanding flow before editing, and the summary gives the developer a map they can verify against the source.

Why this answer

Effective exploration with Claude Code means asking for synthesized understanding of relationships: tracing a request from route to service and describing how middleware, routing, and dependency injection connect. Those tasks exploit the agent's ability to read across files and explain architecture. Inventory-style listings, test counts, and reformatting do not reveal how requests flow and therefore fail to build the mental model.

Exam trap

The trap here is equating any repository-wide command with genuine architectural understanding, when only tasks that trace relationships and wiring actually explain request flow.

30
MCQhard

What is the role of the user when using Claude Code for a complex refactoring task?

A.The user is only responsible for providing the initial prompt.
B.The user acts as the strategic architect and final validator.
C.The user should avoid interfering to prevent conflicts.
D.The user must perform all terminal commands manually.
AnswerB

The user defines the vision and validates the output. The AI serves as an extension of the developer's capabilities, performing the routine coding tasks. This partnership ensures that the agent's output is aligned with high-level goals while the user provides the necessary human oversight and quality assurance.

Why this answer

The user remains the architect and final auditor of the code. While Claude Code handles the heavy lifting of writing code and executing tests, the human user must provide strategic direction, approve individual changes, and verify the final outcomes. This synergy is key to effective AI-assisted development, as it allows the developer to leverage the agent's speed and breadth of knowledge while maintaining ultimate control over the project's design and long-term maintainability.

Exam trap

Many users mistakenly believe the agent is fully autonomous for refactoring. They forget that the human must remain the final validator, leading to potential issues where unreviewed code is merged into production.

31
MCQeasy

A developer repeatedly types the same multi-step instruction to Claude Code: review the current diff, run the unit tests, and summarize any failures. They want to trigger this workflow with a single short command in future sessions. What should they create?

A.A custom slash command stored as a markdown file in the project's `.claude/commands` directory.
B.A new entry in CLAUDE.md that lists the three steps.
C.A `.claude/settings.json` field named `shortcuts` mapping a key to the instruction text.
D.A shell alias in the developer's `.bashrc` that pipes the instruction into a Claude Code process.
AnswerA

Custom slash commands are defined as markdown files under `.claude/commands` and are invoked by typing a short slash command. The file can contain the full multi-step instruction, so the developer triggers the whole workflow with one command. This is the documented way to package repeatable prompts for reuse across sessions in a project.

Why this answer

Custom slash commands are markdown files placed in `.claude/commands` that become invocable by name. Storing the review-test-summarize instruction in such a file lets the developer trigger the entire workflow with one short command in any session in that project. Memory files provide passive context, shell aliases live outside Claude Code, and no settings shortcut field exists for this purpose.

Exam trap

The trap here is assuming CLAUDE.md can be invoked like a command, when it only supplies passive context and cannot be triggered on demand as a reusable workflow.

32
Multi-Selecthard

Which THREE of these actions are considered safe and standard for Claude Code to perform during an interactive session?

Select 3 answers
A.Reading and summarizing codebase files.
B.Modifying files based on user requests.
C.Deleting arbitrary user files without asking.
D.Running test suites to verify changes.
E.Exfiltrating environment variables to remote servers.
AnswersA, B, D

This is a core capability. The agent reads files to understand the project structure and logic, providing summaries that help the developer navigate the codebase faster. This read-only access is entirely safe and provides the necessary context for the agent to be helpful and accurate.

Why this answer

Claude Code is built with safety as a priority. It is expected to handle file editing, command execution, and code review as part of its normal operation. Understanding these standard actions allows developers to trust the agent's output and integrate it into their workflow efficiently.

By focusing on safe, verified, and transparent interactions, the agent maintains its role as a helpful assistant while minimizing risks associated with uncontrolled automation in a local project.

Exam trap

Candidates sometimes assume an agent should 'just fix' everything without verification. They overlook that running tests is a standard, required safety step for any autonomous code modification workflow.

Ready to test yourself?

Try a timed practice session using only Claude Code questions.