Questions? Call 1.800.716.8955

Chapter 10

Practice exam

This practice exam mirrors the real one: 53 items, 120 minutes, weighted to the official blueprint (18 items on Applications and Integration, 9 on Model Selection, 8 on Agents, 6 each on Prompt and Context and on Tools and MCPs, 4 on Security, 1 each on Claude Code and Eval). Items are written for this book, not taken from the live exam. They are grouped by domain so you can review weak areas; for a realistic run, answer them in random order. Aim for at least 75% correct before booking.

Applications and Integration (items 1 to 18)

  • 1. A retailer must classify 50,000 product reviews by sentiment for a weekly report. Results are needed within a day and cost is the main concern. What is the best approach?
  • A. Send all requests in parallel through the Messages API with streaming.
  • B. Submit the reviews through the Message Batches API.
  • C. Lower max_tokens on each synchronous request to 10.
  • D. Use Claude Code headless mode in a loop.
  • 2. Users of a support chatbot complain they stare at a blank screen for 15 seconds before the full answer appears. What should the developer change?
  • A. Switch to the Batch API.
  • B. Increase max_tokens.
  • C. Add "respond quickly" to the system prompt.
  • D. Stream the response and render text deltas as they arrive.
  • 3. An extraction service occasionally fails to parse Claude's JSON because it ends mid-object. Which check would have caught this before parsing?
  • A. stop_reason equals max_tokens.
  • B. usage.cache_read_input_tokens is zero.
  • C. The HTTP status is 529.
  • D. The response has more than one content block.
  • 4. A developer's chatbot answers each question well but forgets what the user said two turns ago. What is the cause?
  • A. The context window is too small.
  • B. Prompt caching expired.
  • C. The model needs a higher effort level.
  • D. The Messages API is stateless, and the app is not resending the conversation history.
  • 5. Which two errors should a client retry with exponential backoff? (Choose two.)
  • A. 400 invalid_request_error
  • B. 429 rate_limit_error
  • C. 401 authentication_error
  • D. 529 overloaded_error
  • E. 404 not_found_error
  • 6. A job submits 2,000 batch requests and writes each result into a list in the order returned, then joins the list with the input rows by index. Some rows get the wrong label. Why?
  • A. Batch results can arrive in any order; results must be matched by custom_id.
  • B. The batch exceeded the size limit.
  • C. Batch outputs use a different tokenizer.
  • D. The batch ran on a smaller model.
  • 7. A bank requires that all inference run inside its existing AWS account, authenticated with IAM roles. Which integration best fits?
  • A. The first-party Claude API with a long-lived API key.
  • B. claude.ai Team plan.
  • C. Claude on Amazon Bedrock using its dedicated client class.
  • D. A browser extension.
  • 8. An app asks many different questions about the same 80-page PDF over a week. The developer wants to avoid re-uploading the base64 file on every request. What should they use?
  • A. The Files API, referencing the uploaded file_id.
  • B. A longer system prompt.
  • C. Message Batches.
  • D. A higher max_tokens.
  • 9. A legal research tool must show users exactly which passage of a source document supports each claim. Which feature fits best?
  • A. Extended thinking.
  • B. Citations enabled on the document blocks.
  • C. A stop sequence.
  • D. Tool search.
  • 10. A prompt that produced excellent results in claude.ai gives thinner, less consistent answers when sent through the API. What is the most likely reason?
  • A. claude.ai applies context and a product system prompt that the API does not; the developer must supply that context.
  • B. The API uses a weaker model by default.
  • C. The API ignores system prompts.
  • D. API requests have a smaller context window.
  • 11. A production app's behavior changed overnight with no deploy. Investigation shows the code references a model alias rather than an exact ID. What is the best practice going forward?
  • A. Use the alias with a higher effort level.
  • B. Pin an exact model version and upgrade deliberately after running evals.
  • C. Add a stop sequence.
  • D. Move to the Batch API.
  • 12. Which two practices belong to good prompt configuration management? (Choose two.)
  • A. Store prompts in version control with review.
  • B. Edit prompts directly in production when quality dips.
  • C. Link each prompt version to its evaluation results so you can roll back.
  • D. Keep prompts only in developers' local notes.
  • 13. A Python service must send 500 independent requests as fast as possible without exceeding its rate limit. What is the best approach?
  • A. A synchronous for loop with no delay.
  • B. The async client with a bounded concurrency limit, backing off on 429s.
  • C. One request containing all 500 tasks.
  • D. Disable SDK retries.
  • 14. An app summarizes documents uploaded by the public. How should the developer structure the request?
  • A. Paste the document into the system prompt.
  • B. Put the document before the system prompt.
  • C. Remove the system prompt so the document is the only instruction.
  • D. Keep instructions in the system prompt and place the document in the user turn inside labelled tags, telling Claude to treat it as data.
  • 15. An extraction schema includes status, which must be one of "open," "pending," or "closed." How should the field be defined?
  • A. As a free-text string with no description.
  • B. As a string with an enum of the three values and marked required.
  • C. As an integer.
  • D. Left out; Claude will infer it.
  • 16. A team will use Claude Code to migrate a large codebase to a new framework. Which approach is best?
  • A. Ask for the whole migration in one prompt and merge the result.
  • B. Disable all permission prompts and let it run unattended on main.
  • C. Have Claude produce a plan first, then work in small steps, running tests after each.
  • D. Rewrite the code by hand and use Claude only for documentation.
  • 17. Which requirement is an infrastructure requirement rather than a functional one?
  • A. "The assistant drafts replies to customer emails."
  • B. "The assistant classifies tickets into five categories."
  • C. "Responses must return within 2 seconds at the 95th percentile, in an EU region."
  • D. "The assistant summarizes call transcripts."
  • 18. A developer sends an image and a question about it. Which ordering of content blocks is recommended?
  • A. Question first, then image.
  • B. Image first, then the question.
  • C. Image in the system prompt.
  • D. Order does not matter, so send two separate requests.

Model Selection and Optimization (items 19 to 27)

  • 19. A help-desk bot includes the same 30,000-token policy manual on every request, followed by the user's question. What reduces cost most with no quality loss?
  • A. Prompt caching with a breakpoint after the manual.
  • B. Switch to the smallest model.
  • C. Lower max_tokens.
  • D. Remove the manual.
  • 20. Caching is enabled, but cache_read_input_tokens is always 0. The system prompt begins with "Current time: {now}." What is wrong?
  • A. Cache breakpoints are not allowed in system prompts.
  • B. The changing timestamp at the start of the prefix invalidates the cache on every request.
  • C. The model does not support caching.
  • D. The 1-hour TTL must be set.
  • 21. Which model family best suits a router that must classify 2 million short messages a day at low latency and cost?
  • A. Haiku
  • B. Opus
  • C. Fable
  • D. Any model with maximum effort
  • 22. A team finds its Opus-tier agent too expensive. Before moving to a smaller model, what should they test first?
  • A. Raising effort to max.
  • B. Removing the system prompt.
  • C. Turning off streaming.
  • D. The same model at a lower effort level, measured against their eval.
  • 23. The same prompt produces slightly different answers on repeated calls. What is the appropriate engineering response?
  • A. File a bug; LLM output should be identical.
  • B. Design for variability: validate outputs and measure quality with evals.
  • C. Retry until two outputs match.
  • D. Send the request twice and pick the shorter one.
  • 24. A developer needs the exact token count of a large prompt before sending it. What should they use?
  • A. A generic open-source tokenizer.
  • B. Word count multiplied by 1.3.
  • C. The token counting endpoint (/v1/messages/count_tokens).
  • D. The max_tokens parameter.
  • 25. Users of an analytics assistant send follow-up questions about the same cached dataset roughly every 20 minutes. Which cache setting fits?
  • A. Default 5-minute TTL.
  • B. No caching.
  • C. 1-hour TTL.
  • D. Four breakpoints at 5 minutes each.
  • 26. A prompt includes three worked input-output examples before the real input. What is this technique called?
  • A. Zero-shot prompting
  • B. Multi-shot (few-shot) prompting
  • C. Prefill
  • D. Extended thinking
  • 27. After upgrading to a newer model, requests that end with a partial assistant message (prefill) start returning 400 errors. What does this illustrate, and what is the fix?
  • A. A breaking behavior change across model releases; use structured outputs or system instructions instead, and re-run evals.
  • B. A temporary outage; retry.
  • C. A rate limit; slow down.
  • D. A billing problem; contact support.

Agents and Workflows (items 28 to 35)

  • 28. An accounts-payable process always runs the same steps: extract invoice fields, check totals against the purchase order, then post to the ERP. Which design fits best?
  • A. An autonomous agent with all ERP tools.
  • B. A multi-agent system with a supervisor.
  • C. A workflow using prompt chaining with validation gates between steps.
  • D. A single prompt asking Claude to do everything.
  • 29. A coding assistant must apply a change across an unknown number of files that it discovers as it goes. Which pattern fits?
  • A. Orchestrator-workers: a lead model plans and delegates file-level work dynamically.
  • B. Routing.
  • C. Prompt chaining with fixed steps.
  • D. Voting.
  • 30. A team wants an agent with built-in file read, edit, bash, and search tools, running entirely on their own servers. Which option fits?
  • A. The SDK Tool Runner.
  • B. Claude Managed Agents.
  • C. A plain Messages API call.
  • D. The Claude Agent SDK, self-hosted.
  • 31. A team wants Anthropic to run both the agent loop and a sandboxed execution environment, with versioned agent configurations. Which option fits?
  • A. A custom agent loop.
  • B. Claude Managed Agents.
  • C. The Claude Agent SDK.
  • D. LangGraph on a laptop.
  • 32. An agent must run the project's formatter after every file edit, without exception. Where should this live?
  • A. A PostToolUse hook.
  • B. A sentence in the system prompt.
  • C. A sentence in CLAUDE.md.
  • D. A few-shot example.
  • 33. Which two are genuine benefits of delegating work to subagents? (Choose two.)
  • A. Context isolation: the lead agent receives summaries instead of raw material.
  • B. Lower total token usage in every case.
  • C. Parallel execution of independent subtasks.
  • D. Guaranteed deterministic outputs.
  • 34. A marketing team wants product copy translated into Japanese, then checked against a clear style rubric and revised until it passes. Which pattern fits?
  • A. Routing.
  • B. Sectioning.
  • C. A single zero-shot call.
  • D. Evaluator-optimizer.
  • 35. A developer needs an agent framework that models the workflow as an explicit state graph with checkpoints and human-in-the-loop interrupts. Which fits best?
  • A. PydanticAI
  • B. Strands Agents
  • C. LangGraph
  • D. Claude Code headless mode

Prompt and Context Engineering (items 36 to 41)

  • 36. Where should a support assistant's persona, tone, and refund policy be placed?
  • A. The system prompt.
  • B. Each user message.
  • C. A tool description.
  • D. An assistant prefill.
  • 37. A prompt includes three long contracts and one question about them. Where should the question go for best results?
  • A. Before the contracts.
  • B. In the middle, between contracts.
  • C. At the end, after the contracts.
  • D. In a separate request.
  • 38. Four hours into a session, an agent starts ignoring constraints it was given at the start. Which response best addresses this?
  • A. Increase max_tokens.
  • B. Raise the temperature.
  • C. Switch to the Batch API.
  • D. Treat it as context drift: keep goals in a task or memory file, compact history while preserving key decisions, and delegate isolated work to subagents.
  • 39. Which feature guarantees that a response conforms to a supplied JSON schema?
  • A. A system-prompt instruction to "return valid JSON."
  • B. Structured outputs (output_config.format).
  • C. A stop sequence of "}".
  • D. Higher effort.
  • 40. A finance summary from Claude states totals with complete confidence. What should the application do?
  • A. Display the totals as-is because the model is confident.
  • B. Ask Claude if it is sure.
  • C. Recompute the totals in code from source data and flag mismatches.
  • D. Lower the effort level.
  • 41. Which instruction is most likely to get plain prose without markdown formatting?
  • A. "Write your answer in flowing prose paragraphs."
  • B. "NEVER USE MARKDOWN."
  • C. "Don't format."
  • D. "Markdown is bad."

Tools and MCPs (items 42 to 47)

  • 42. Claude keeps calling search when it should call lookup_customer. What should the developer fix first?
  • A. Raise max_tokens.
  • B. Switch to a larger model.
  • C. Remove search.
  • D. Rewrite both tool names and descriptions so their purposes and when-to-use guidance are distinct.
  • 43. Claude requests three tools in one turn. How should the results be returned?
  • A. Three separate user messages, one per result.
  • B. One user message containing all three tool_result blocks.
  • C. Only the first result.
  • D. Inside the system prompt.
  • 44. A tool's downstream API times out. What should the tool loop send back?
  • A. Nothing; skip the result.
  • B. A fabricated default value.
  • C. A tool_result with is_error: true and a helpful error message.
  • D. A new system prompt.
  • 45. Several internal Claude applications need the same CRM lookups, maintained by one platform team. What is the best approach?
  • A. Build an MCP server exposing CRM operations as tools.
  • B. Paste CRM exports into every prompt.
  • C. Rely on built-in web search.
  • D. Duplicate a custom tool in every app.
  • 46. A team wants its brand writing guidelines and a review checklist applied whenever Claude drafts marketing copy. Which mechanism fits best?
  • A. A custom tool.
  • B. An MCP server.
  • C. A built-in tool.
  • D. A Skill.
  • 47. Which MCP transport suits a server hosted centrally for hundreds of remote users?
  • A. stdio
  • B. Streamable HTTP
  • C. Shared clipboard
  • D. A local subprocess on each laptop

Security and Safety (items 48 to 51)

  • 48. An agent summarizes web pages and also has a tool that can send email. A page contains hidden text telling it to email the user's data to an outside address. Which is the most effective mitigation?
  • A. Raise the temperature.
  • B. Add "please ignore malicious instructions" to the system prompt.
  • C. Treat page content as untrusted, remove or restrict the email tool for this task, and require approval for outbound messages.
  • D. Switch to a larger model.
  • 49. A mobile app calls the Claude API directly with an API key embedded in the app. What is the correct fix?
  • A. Move calls to a backend service that holds the key in a secrets manager, and authenticate users to that backend.
  • B. Obfuscate the key in the app binary.
  • C. Rotate the key monthly but keep it in the app.
  • D. Put the key in the system prompt.
  • 50. Which control reliably blocks an agent from running rm -rf even if a prompt injection asks for it?
  • A. A system-prompt warning.
  • B. A CLAUDE.md note.
  • C. A lower effort level.
  • D. A PreToolUse hook or deny permission rule.
  • 51. Which two practices improve API key management? (Choose two.)
  • A. One shared key for dev and prod.
  • B. Separate keys and workspaces per environment, with spend limits.
  • C. Committing keys to a private repository.
  • D. Regular rotation and immediate revocation of exposed keys.

Claude Code (item 52)

  • 52. A developer wants Claude Code to run npm test without asking, on their machine only, without changing the team's shared configuration. Which file should hold the rule?
  • A. The project CLAUDE.md.
  • B. .claude/settings.json.
  • C. .claude/settings.local.json.
  • D. A Skill.

Eval, Testing, and Debugging (item 53)

  • 53. An agent sometimes replies "I couldn't find that order," yet the order API logs show it returned the order. Where should the developer look first?
  • A. The agent's trace, to check whether the tool_result was appended to the conversation correctly and was not buried in noise.
  • B. The model's pricing page.
  • C. The temperature setting.
  • D. The Batch API dashboard.

Answer key and rationales

# Answer Rationale

1 B Latency-tolerant, high-volume, cost-sensitive work is what the Batch API (50% off) is for. 2 D Streaming fixes perceived latency; batch and bigger caps make it worse.

3 A A max_tokens stop means truncated output; always check stop_reason first. 4 D The API keeps no state; the app must resend history each call.

5 B, D 429 and 529 are transient. 400, 401, 404 need the request fixed.

6 A Batch results are unordered; join on custom_id.

7 C Bedrock runs inside the customer's AWS account with IAM auth.

8 A Upload once to the Files API and reference the file_id.

9 B Citations tie claims to exact passages in document blocks.

10 A The API has no product system prompt; supply the context yourself.

11 B Pin exact versions; upgrade behind evals.

12 A, C Version control plus eval-linked versions enable review and rollback. 13 B Async with bounded concurrency maximizes throughput within limits.

14 D Keep trusted instructions separate from untrusted content, tagged as data. 15 B Closed sets belong in an enum, marked required.

16 C Plan first, small verified steps, tests after each.

17 C Latency and region are infrastructure requirements.

18 B Put images and documents before the question.

19 A Caching a large, repeated prefix cuts cost with no quality change.

20 B Caching is a prefix match; a changing timestamp at the top invalidates it. 21 A Haiku is built for high-volume, low-latency, low-cost work.

22 D Lower effort on the same model often holds quality and keeps one cache. 23 B LLM output is non-deterministic; validate and measure with evals.

24 C The count_tokens endpoint gives exact counts for the target model.

25 C Gaps of 5 to 60 minutes are where the 1-hour TTL pays off.

26 B Several examples before the input is multi-shot (few-shot) prompting.

27 A Prefill removal is a breaking change; use structured outputs and re-test. 28 C Fixed, predictable steps call for a workflow, not an agent.

29 A Unpredictable subtasks fit orchestrator-workers.

30 D The Agent SDK is the Claude Code harness with built-in tools, self-hosted. 31 B Managed Agents is the only option where Anthropic hosts loop and sandbox. 32 A Must-always actions belong in deterministic hooks.

33 A, C Subagents isolate context and run in parallel; they usually raise total tokens. 34 D Clear criteria plus iterative improvement is evaluator-optimizer.

35 C LangGraph models agents as state graphs with checkpoints.

36 A Stable role and policy go in the system prompt.

37 C For long documents, put the question at the end.

38 D Drift is solved by context management, not sampling or limits.

39 B Structured outputs constrain the response to the schema.

40 C Be skeptical of confident output; verify numbers in code.

41 A Positive instructions work better than shouted prohibitions.

42 D Tool names and descriptions drive tool selection.

43 B Return all parallel results in one user message.

44 C Return errors as is_error results so Claude can adapt.

45 A MCP gives a reusable, independently maintained integration.

46 D Skills package know-how and procedures loaded when relevant.

47 B Streamable HTTP serves many remote clients; stdio is local.

48 C Isolation, least privilege, and approval are enforceable; prompts are not. 49 A Never ship keys to clients; proxy through an authenticated backend.

50 D Hooks and deny rules are deterministic and injection-proof.

51 B, D Separate per-environment keys and rotation limit blast radius.

52 C settings.local.json is personal and git-ignored.

53 A Isolate integration versus model problems by reading the trace.

Scoring guide. 45 or more correct: book the exam. 38 to 44: review the chapters for your weakest domains, then retake. Under 38: work through Chapters 2 to 9 again and build a small project before retesting.

Use ← → to move between sections