Courseiva

CCDV-F Prompt and Context Engineering Practice Question

A developer is using the Messages API to have Claude return a JSON object describing a product. The response sometimes includes a conversational preamble such as 'Here is the JSON you requested:' before the object, which breaks the downstream parser. What is the most reliable way to eliminate the preamble?

⚠ Common exam trap

The trap here is treating a prompt instruction like 'no preamble' as equivalent to a structural constraint, when only prefill actually prevents leading text.

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

✓

Use the assistant turn prefill with an opening curly brace so the response must continue from that character.

Prefilling the assistant turn with an opening brace removes the space where a preamble could be generated, forcing the response to begin mid-JSON. Instructions and temperature settings only bias behavior probabilistically, and token limits address length rather than structure. Prefill is the only option that structurally guarantees the response starts with the expected character.

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 model has enough room to output the full JSON without truncation.

    Why it's wrong here

    Max tokens governs length and truncation, not the presence of a preamble. The problem is an unwanted prefix, not a cut-off object, so raising the limit does nothing to remove conversational text. It may even permit a longer preamble. This parameter is unrelated to the parsing failure described.

  • ✓

    Use the assistant turn prefill with an opening curly brace so the response must continue from that character.

    Why this is correct

    Prefilling the assistant message with an opening brace constrains generation to continue from that exact point, so no preamble can appear before the JSON. The API returns the prefilled text plus the continuation, giving a clean object. This is a structural guarantee rather than a probabilistic instruction, which is why it is the most reliable fix.

  • ✗

    Set the temperature to zero so the model always produces the same output.

    Why it's wrong here

    Temperature affects sampling randomness, not response structure. Even at zero, the model can consistently emit a preamble because that behavior is driven by the prompt and training, not by sampling variance. Determinism makes the same wrong output repeatable rather than removing the unwanted prefix.

  • ✗

    Add 'Do not include any preamble' to the system prompt and hope the model complies.

    Why it's wrong here

    A natural-language instruction reduces but does not eliminate preamble, because the model may still add courtesy text on some requests. The scenario requires reliable parsing, and a probabilistic instruction cannot guarantee that the first character of the response is a brace. It is a weaker control than structurally constraining the start of the assistant's output.

About these practice questions

This CCDV-F question is part of Courseiva's 257-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 →

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 CCDV-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 CCDV-F exam.