Courseiva

CCAO-F Prompting and Context Engineering Practice Question

A logistics company uses Claude to extract shipment details from scanned customs forms. The forms are supplied as raw OCR text that contains occasional garbled characters and spurious line breaks. The developer wants to reduce the number of fields Claude invents when a value is missing on the form. Which prompt structure change is most likely to achieve this?

⚠ Common exam trap

The trap here is assuming that lowering temperature or switching to JSON output eliminates hallucinated fields, when the actual gap is the absence of an explicit instruction about what to do when data is missing.

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

✓

Wrap the OCR text in <document> tags and add the instruction: 'If a field cannot be found in the document, return null for that field.'

The reliable fix pairs two techniques: structural delimitation of the source text so Claude can tell document content from instructions, and an explicit rule stating what to do when a field is absent. Together they remove the ambiguity that pushes the model toward inventing values, and the null convention makes the result easy to validate programmatically.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Shorten the OCR text by removing all line breaks before inserting it into the prompt.

    Why it's wrong here

    Collapsing line breaks may reduce token count, but it does not tell Claude what to do when a field is absent. Garbled characters remain, and the model still faces the same pressure to fill every requested field. Without a defined fallback, removing formatting noise alone does not prevent invented values in the extraction output.

  • ✗

    Set temperature to 0 and request the output as a JSON object.

    Why it's wrong here

    Low temperature makes sampling more deterministic, and JSON output improves parseability, but neither addresses the underlying cause. A deterministic model can still confidently emit an invented value for a field that is not present in the OCR text. The missing piece is an explicit rule for absent data, not a decoding or format adjustment.

  • ✗

    Add the instruction: 'Be as accurate as possible and avoid mistakes.'

    Why it's wrong here

    Generic accuracy exhortations do not specify the desired behavior when data is missing. Claude has no way to distinguish a genuinely absent field from a field it failed to locate, so it may still produce plausible-looking values. The instruction adds tokens without changing the decision boundary that causes hallucinated fields.

  • ✓

    Wrap the OCR text in <document> tags and add the instruction: 'If a field cannot be found in the document, return null for that field.'

    Why this is correct

    Delimiting the OCR text with XML-style tags separates source content from instructions, and the explicit fallback rule gives Claude a sanctioned behavior for missing values. This combination reduces fabrication because the model no longer needs to guess to satisfy an implicit expectation that every field exists. The null convention is also machine-checkable downstream.

About these practice questions

Courseiva writes every CCAO-F question from scratch — 259 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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.