Claude Certified Associate (Foundations) · Domain 1 · 20% of exam

Claude Models and the Messages API

Drill 20 practice questions focused entirely on Claude Models and the Messages API for the Anthropic CCAO-F exam. Tap an answer for instant feedback and a full explanation — no sign-up, always free.

Verified answer20 questions
Question 1 of 20

A developer is building a feature that asks Claude to classify support tickets and return only a single category word (e.g., 'Billing'). They notice Claude sometimes prepends conversational text like 'Sure, the category is...' before the answer. Using only the Messages API structure, what is an effective technique to make Claude begin its response with the category directly?

Reviewed for accuracy · Report an issue
Question 2 of 20

You are building a customer support chatbot using the Messages API. To preserve context across turns, you send the full conversation history with each new request. In this history, what content should be placed in messages that use the 'assistant' role?

Reviewed for accuracy · Report an issue
Question 3 of 20

Your team is building a legal document analysis feature that must reason through complex, multi-clause contracts and produce nuanced summaries. Accuracy on subtle legal reasoning is the top priority, and the feature runs asynchronously in the background, so response time is not a concern. Occasional per-request cost is acceptable given the low volume. Which model-selection approach best fits these requirements?

Reviewed for accuracy · Report an issue
Question 4 of 20

Your team runs a customer-support chat tool that classifies incoming messages into one of five intent categories. The task is simple and well-defined, but you process millions of messages per day and need responses in well under a second while keeping costs low. Accuracy on this narrow task is already excellent with smaller models. Which model-selection approach best fits these requirements?

Reviewed for accuracy · Report an issue
Question 5 of 20

A developer at a legal-tech company needs to analyze a single 280,000-token contract in one API call to answer questions about clauses scattered throughout the document. Their current integration truncates the document because it exceeds the model's input limit, causing incomplete answers. Which approach best addresses the root cause while keeping the analysis in a single request?

Reviewed for accuracy · Report an issue
Question 6 of 20

A developer is building a chatbot that generates short product descriptions. They want to ensure Claude never produces a reply longer than roughly 150 words, both to control cost and keep the UI clean. Which Messages API parameter should they configure for this purpose?

Reviewed for accuracy · Report an issue
Question 7 of 20

You are building a feature that asks Claude to return a detailed JSON object summarizing a customer support ticket. During testing, you notice the model's responses are consistently cut off mid-object, producing invalid JSON that your parser rejects. Your prompt and temperature settings appear correct. Which change is most likely to resolve the truncation?

Reviewed for accuracy · Report an issue
Question 8 of 20

A developer is writing their first integration with the Messages API. They construct a request with the model name, a system prompt, and a single user message, then send it. The API returns an error before any generation occurs. Which commonly-omitted required parameter is the most likely cause of the error?

Reviewed for accuracy · Report an issue
Question 9 of 20

A developer is building a customer support chatbot with the Messages API. They want to send a conversation that includes the user's first question, Claude's first answer, and the user's follow-up question in a single API request so Claude can respond with full context. How should the `messages` array be structured?

Reviewed for accuracy · Report an issue
Question 10 of 20

A developer is building a billing dashboard for an internal tool that uses the Messages API (non-streaming). After each request completes, they need to record exactly how many input and output tokens were consumed by that specific call, without having to re-estimate the text themselves. Where should they look to get this accurate per-request count?

Reviewed for accuracy · Report an issue
Question 11 of 20

You are building a customer support chatbot with the Messages API. A user has asked three questions across a session, and Claude has answered each one. The user now types a follow-up that says 'What about the second option you mentioned?' To ensure Claude can correctly reference its earlier reply, how should you structure the request?

Reviewed for accuracy · Report an issue
Question 12 of 20

A support team sends requests to Claude that all begin with the same 8,000-token knowledge base document, followed by a short, unique customer question that changes with every request. They enable prompt caching to reduce cost and latency. To get the maximum benefit from caching, where should the reusable content be positioned relative to the variable content in each request?

Reviewed for accuracy · Report an issue
Question 13 of 20

You are building a customer-support assistant that answers questions about a 40-page product manual. Every request sends the same large manual as context in the system prompt, followed by a different short user question. Latency and cost are climbing as traffic grows. Which Messages API feature best addresses this while keeping the manual available on every turn?

Reviewed for accuracy · Report an issue
Question 14 of 20

You are building a chatbot that generates structured dialogue scripts. Each script line follows the format 'Speaker: text'. You want Claude to generate exactly one line of dialogue per API call and stop before it starts writing the next speaker's line. Which Messages API parameter should you configure to reliably halt generation at that point?

Reviewed for accuracy · Report an issue
Question 15 of 20

You are building a chatbot that generates short dialogue snippets between two characters named 'Alice' and 'Bob'. You want the model to generate only Alice's next line and stop before it starts writing Bob's response or any narration marker. In your Messages API request, you set stop_sequences to ["Bob:", "\n\n"]. When generation halts because the model produces the text 'Bob:', what will the API response indicate and what will be returned?

Reviewed for accuracy · Report an issue
Question 16 of 20

A developer is building a code-generation tool that should stop producing output as soon as Claude writes the closing marker '```' at the end of a code block, rather than continuing with explanatory prose. Which Messages API parameter is best suited to achieve this specific behavior?

Reviewed for accuracy · Report an issue
Question 17 of 20

You are building a customer-facing chatbot that generates lengthy, detailed troubleshooting guides. Users have complained that after they submit a question, the interface appears frozen for many seconds before the full answer suddenly appears all at once. You want to improve the experience without changing the length or quality of the generated content. Which change to how you call the Messages API best addresses this?

Reviewed for accuracy · Report an issue
Question 18 of 20

You are building a customer-facing chat assistant with Claude that often produces long, multi-paragraph answers. Users have complained that the interface feels frozen for several seconds before any text appears. The total generation time cannot be reduced much, but you want the experience to feel more responsive. Which change to your Messages API integration best addresses this complaint?

Reviewed for accuracy · Report an issue
Question 19 of 20

A developer is building a chat feature that streams Claude's responses to the user in real time. After the stream completes, they need to log the exact number of input and output tokens consumed so they can track per-conversation cost. Where in the streaming flow should they look to get this final token usage?

Reviewed for accuracy · Report an issue
Question 20 of 20

You are building a product-review analysis feature that must return each result as JSON with fields 'sentiment', 'topics', and 'summary' so a downstream service can parse it reliably. In your testing, Claude sometimes wraps the JSON in conversational text like 'Sure! Here is the analysis:' which breaks the parser. Using the Messages API, what is the most effective way to get consistently parseable structured output?

Reviewed for accuracy · Report an issue

More CCAO-F practice

Keep going with the other Claude Certified Associate (Foundations) domains, or take a full timed mock exam.

← Back to CCAO-F overview