Courseiva

CCAR-F Prompt Engineering and Structured Output Practice Question

A platform team is building a Claude-powered service that returns structured records to a downstream database. During testing, roughly 4% of responses include a friendly sentence before the JSON, and another 3% omit a required field entirely. Which TWO changes most directly reduce these failure modes? (Choose two.)

⚠ Common exam trap

The trap here is treating both failures as one generic 'model quality' problem and reaching for a single global knob like temperature or max_tokens, when each defect has a separate, prompt-level cause that must be fixed independently.

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

✓

List every required field with its type and a short description, and instruct the model to include all fields even when a value is unknown.

The two observed defects have distinct causes: conversational framing produces leading sentences, and unstated field requirements produce omissions. An instruction forbidding any text outside the JSON object fixes the first, while enumerating every field with its type and a rule for unknown values fixes the second. Token budget, temperature, and format changes do not target either root cause and would leave both failure rates essentially unchanged.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Switch the output format from JSON to a comma-separated list to simplify parsing.

    Why it's wrong here

    CSV has no native way to express nested structures or missing values unambiguously, and it does not prevent preamble text either. Changing format introduces new parsing hazards such as escaped commas and quoting rules without addressing the two specific failure modes. The database expects structured records, so abandoning JSON adds risk rather than removing it.

  • ✓

    List every required field with its type and a short description, and instruct the model to include all fields even when a value is unknown.

    Why this is correct

    Omitted fields usually stem from the model deciding a value is unavailable or unimportant. Enumerating each field with its type and a description, plus an explicit rule to emit every field and use a null or sentinel for unknowns, removes that judgment call. This directly addresses the 3% omission rate while keeping the schema stable for the database loader.

  • ✗

    Lower the temperature to 0 and rely on that alone to eliminate both the preamble and the missing fields.

    Why it's wrong here

    Temperature 0 reduces sampling randomness but does not change the model's interpretation of the task. A prompt that permits conversational framing will still occasionally produce a leading sentence at temperature 0, and a prompt that does not enumerate required fields will still see omissions. This change alone leaves both observed failure modes largely intact.

  • ✗

    Increase max_tokens substantially so the model has room to complete every field.

    Why it's wrong here

    The failures are omitted fields, not truncated responses, so extra token budget does not address the root cause. Raising max_tokens only helps when the model is cut off mid-object; here the model is choosing to skip a field. This change would add cost without measurably reducing the 3% omission rate, and it does nothing for the 4% preamble problem.

  • ✓

    Add an explicit instruction that the response must begin with the opening brace and contain no preamble or trailing commentary.

    Why this is correct

    The 4% preamble failures come from the model treating the request as conversational. A direct instruction that the very first character must be '{' and that no prose may precede or follow the object removes the ambiguity about whether commentary is welcome. This targets the observed failure mode precisely and is cheaper and more reliable than post-hoc stripping of leading sentences.

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 →

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.