CCAO-F Prompting and Context Engineering Practice Question
A financial analyst is building a Claude-powered assistant that must extract line items from scanned invoices and return them as a JSON array. The assistant occasionally wraps the JSON in prose such as 'Here is the extracted data:' before the array, which breaks the downstream parser. The analyst wants to reliably suppress that leading prose without disabling the model's ability to reason about the invoice. Which approach is most appropriate?
⚠ Common exam trap
The trap here is assuming that lowering temperature or adding a 'only output JSON' instruction guarantees structured output, when only an assistant-turn prefill actually constrains the first generated tokens.
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
✓
Add an assistant-turn prefill such as '{' so Claude continues directly into the JSON object instead of narrating.
Starting the assistant turn with an opening brace forces the model to continue from that token, which structurally eliminates the conversational preamble while preserving the reasoning that happens before generation. Soft instructions and sampling parameters reduce but do not guarantee the absence of prose, so the prefill is the reliable mechanism for downstream JSON parsing.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Increase max_tokens so the prose has room to finish before the JSON array begins.
Why it's wrong here
Raising max_tokens only extends the generation budget; it does not influence whether a preamble is emitted. Giving the response more room would simply allow a longer narration before the array, making the parsing problem worse rather than removing the leading prose the analyst wants to eliminate.
- ✗
Wrap the invoice text in XML tags and ask Claude to 'only output JSON' in the system prompt.
Why it's wrong here
XML tags and an instruction help ground the model in the invoice content, but a natural-language 'only output JSON' directive is a soft constraint that Claude may still violate across varied invoice layouts. It does not hard-constrain the first emitted tokens the way an assistant-turn prefill does, so intermittent prose can persist.
- ✗
Lower the temperature to 0 so the model stops generating any prose tokens.
Why it's wrong here
Temperature 0 makes sampling deterministic and favors the highest-probability token, but it does not change the model's learned tendency to introduce structured output with a sentence. At temperature 0 the assistant would still reliably produce the same friendly preamble, so the parser would fail in exactly the same way every time.
- ✓
Add an assistant-turn prefill such as '{' so Claude continues directly into the JSON object instead of narrating.
Why this is correct
Prefilling the assistant turn with an opening brace constrains the continuation: Claude treats the prefill as already-generated output and continues from it, so it skips the conversational preamble and emits the JSON body. Reasoning still occurs in the model's forward pass before the prefill, so invoice analysis is preserved while the parser receives clean JSON.
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 →
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.