Courseiva
Using the Claude API →hardMultiple Choice

CCAO-F Using the Claude API Practice Question

A developer wants Claude to call an internal inventory function when a user asks about stock levels, but the function must only be invoked when the model decides it is needed. The application will execute the function and return the result. Which sequence correctly implements this with the Messages API?

⚠ Common exam trap

The trap here is believing the model itself executes the function, when in fact the application runs it and must return the result keyed to the tool_use id.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Send the tools definition; if the response contains a tool_use block, run the function and send a new request including a tool_result block referencing the tool_use id.

Tool use is a round trip: the application declares tools, the model optionally returns a tool_use block, the application executes the named function, and it sends back a tool_result block that references the tool_use id so the model can incorporate the real output. Pre-running functions, prose-based parsing, or empty acknowledgements all break this contract.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    Send the tools definition; if the response contains a tool_use block, run the function and send a new request including a tool_result block referencing the tool_use id.

    Why this is correct

    This matches the tool use contract: tools are declared in the request, the model may return a tool_use content block with an id, and the application executes the function and returns a tool_result block that references that same id in a follow-up request, allowing the model to produce a final answer grounded in real data.

  • ✗

    Pre-execute the inventory function on every request and inject its output into the system prompt.

    Why it's wrong here

    Calling the function unconditionally defeats the purpose of letting the model decide when it is needed. It wastes backend calls for unrelated questions, embeds stale data into the system prompt, and bypasses the tool use mechanism that lets Claude request the lookup at the right moment.

  • ✗

    Define the function in the system prompt as a description and parse the model's prose reply for a function name.

    Why it's wrong here

    Describing a function in prose provides no structured invocation contract. The model would emit text that the application must heuristically parse, which is brittle and error-prone compared with the tools parameter, where the model returns a typed tool_use block the application can act on reliably.

  • ✗

    Send the tools definition and, upon receiving a tool_use block, immediately send a tool_result with an empty payload to acknowledge it.

    Why it's wrong here

    Returning an empty tool_result without actually executing the function gives the model no data. It acknowledges the call but leaves the stock-level question unanswered, so the model cannot produce a grounded reply and may fabricate values, defeating the integration's purpose.

About these practice questions

This CCAO-F question is part of Courseiva's 259-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Anthropic exam blueprint

This CCAO-F practice question is part of Courseiva's free Anthropic certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CCAO-F exam.