CCAR-F Prompt Engineering and Structured Output Practice Question
A financial analyst wants Claude to extract the total amount due from each invoice in a batch of 300 PDF-extracted text blobs, returning results as JSON with fields "invoice_id", "amount_due", and "currency". Some invoices list multiple line items and a subtotal, while others show only a single grand total. Which prompt design most reliably produces consistent, machine-parseable extraction across all invoices?
⚠ Common exam trap
The trap here is assuming that asking for a summary of financial figures will naturally yield the amount due in a parseable form, when summaries vary in wording and often surface subtotals instead of the grand total.
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
✓
Provide a strict JSON schema with the three required fields, instruct Claude to output only valid JSON, and include two worked examples covering both single-total and multi-line-item invoices.
Reliable batch extraction requires a fixed schema, an explicit instruction to emit only JSON, and few-shot examples that cover every structural variant in the input set. Combining a named-field schema with instruction and examples constrains the model's output shape so a parser can consume it without manual intervention. Free-text, high-temperature, or echo approaches all fail to yield consistent, machine-readable fields.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Ask Claude to 'summarize the key financial figures' and parse whatever numbers appear in the free-text response.
Why it's wrong here
Free-text summarization produces prose that varies in phrasing and ordering across the 300 invoices, so a downstream parser cannot reliably locate the amount due. The scenario requires a fixed schema with named fields, not a narrative summary. This approach also risks the model reporting subtotals or individual line items instead of the single grand total, breaking aggregation.
- ✓
Provide a strict JSON schema with the three required fields, instruct Claude to output only valid JSON, and include two worked examples covering both single-total and multi-line-item invoices.
Why this is correct
Specifying the exact JSON schema fixes the output shape, the 'output only valid JSON' instruction suppresses prose wrappers, and the two few-shot examples teach Claude how to reconcile multi-line invoices to a single amount_due. Together these make the extraction deterministic enough for automated parsing across all 300 documents, including the two structural variants present in the batch.
- ✗
Ask Claude to return the entire invoice text unchanged so the analyst can manually locate the amount due in each document.
Why it's wrong here
Echoing the full invoice back defeats the purpose of automated extraction and provides no structured fields for downstream processing. The analyst would still need to read 300 documents manually, which is exactly the task the system is meant to remove. This neither produces the required JSON schema nor reduces the human workload.
- ✗
Set the temperature to 1.0 so Claude produces varied outputs, then use a fuzzy regex to catch any dollar amounts in the response.
Why it's wrong here
High temperature increases output variability, which is the opposite of what a batch extraction pipeline needs. Fuzzy regex on dollar amounts cannot distinguish subtotal, tax, or line-item values from the actual amount due, so it will frequently capture the wrong number. The scenario demands deterministic field mapping, not creative variation.
About these practice questions
One of 271 original CCAR-F practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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 CCAR-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 CCAR-F exam.