Courseiva

CCAR-F Prompt Engineering and Structured Output Practice Question

When designing a prompt for high-reliability JSON extraction from unstructured medical reports, which THREE strategies are considered best practices for Anthropic models?

⚠ Common exam trap

Candidates often overlook the necessity of prefilling the assistant response, incorrectly believing that a system prompt instruction alone is sufficient to guarantee valid JSON formatting in all cases.

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 clear JSON schema or template.

Achieving reliable structured output involves providing a clear schema, showing the model examples of the desired output, and using prefilling to guide the start of the response. These techniques combined minimize formatting errors and ensure the model adheres to the specific data types and keys required by the application.

Answer analysis

Option-by-option breakdown

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

  • ✓

    Provide a clear JSON schema or template.

    Why this is correct

    Defining the keys and expected data types in a schema gives Claude a blueprint to follow. This reduces ambiguity about how to represent specific medical findings and ensures that the resulting JSON can be reliably parsed by downstream software systems without manual intervention or complex regex.

  • ✓

    Use few-shot examples with valid JSON output.

    Why this is correct

    Examples demonstrate the exact formatting and level of detail required for the extraction. By seeing how previous reports were converted into JSON, Claude can better handle edge cases and nuances in the medical terminology, leading to more consistent and accurate structured data generation.

  • ✓

    Prefill the assistant response with '{'.

    Why this is correct

    Prefilling the opening brace is the most effective way to eliminate conversational filler. It forces Claude to begin the JSON object immediately, which is critical for automated pipelines that expect a raw JSON string rather than a natural language explanation followed by a code block.

  • ✗

    Set the temperature to 1.0 for diverse extractions.

    Why it's wrong here

    High temperature is detrimental to structured data extraction because it increases the risk of syntax errors, such as missing quotes or braces. For JSON tasks, a temperature of 0.0 is almost always preferred to ensure maximum determinism and adherence to the specified schema.

  • ✗

    Avoid using XML tags for the input reports.

    Why it's wrong here

    Avoiding XML tags is actually counter-productive. Using tags like <report> to wrap the unstructured medical text helps the model distinguish the data source from the instructions, which improves the extraction accuracy. XML and JSON can be used effectively together in the same prompt.

About these practice questions

Courseiva writes every CCAR-F question from scratch — 271 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 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.