Courseiva

AIF-C01 Fundamentals of Generative AI Practice Question

A developer wants a foundation model to reliably return a structured record with fixed fields for downstream processing. The model currently returns free-form prose that breaks parsing. Which technique most directly improves output reliability for this use case?

⚠ Common exam trap

The trap here is believing that telling a model to produce JSON in the prompt is the same as guaranteeing valid JSON.

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

✓

Define a JSON schema and use constrained decoding or structured output features so the model can only emit tokens valid under that schema

Structured output reliability comes from constraining decoding to a schema, which makes invalid tokens impossible rather than merely unlikely. Prompt-based requests for JSON and retry loops reduce but do not eliminate malformed output, raising temperature increases variability, and shortening the prompt removes guidance without adding enforcement. Schema-constrained generation is the direct fix.

Answer analysis

Option-by-option breakdown

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

  • ✓

    Define a JSON schema and use constrained decoding or structured output features so the model can only emit tokens valid under that schema

    Why this is correct

    Constrained decoding restricts the token sampling space to sequences that satisfy the schema, guaranteeing syntactically valid structured output that downstream parsers can consume. This directly targets the parsing failures caused by free-form prose, unlike prompt wording changes that merely encourage format adherence.

  • ✗

    Increase the model's temperature so it generates more varied field values

    Why it's wrong here

    Temperature governs randomness in token selection. Raising it makes output less predictable and more likely to deviate from a required structure, worsening parse failures. It does not constrain the model to a schema and is counterproductive when deterministic, well-formed output is the goal.

  • ✗

    Shorten the prompt so the model has fewer instructions to follow

    Why it's wrong here

    Removing instructions does not add any structural enforcement; the model still chooses freely among tokens and may return prose. Brevity can even strip away format guidance, making structured output less likely. The root cause is the absence of a decoding constraint, not prompt length.

  • ✗

    Add the phrase 'respond in JSON' to the user prompt and retry on parse failures

    Why it's wrong here

    Prompt instructions raise the likelihood of JSON but do not enforce it; models can add prose, comments, or malformed brackets. Retrying on failure adds latency and cost and still offers no guarantee, so the parsing problem persists intermittently, which is unacceptable for automated downstream processing.

About these practice questions

One of 862 original AIF-C01 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 Amazon Web Services exam blueprint

This AIF-C01 practice question is part of Courseiva's free Amazon Web Services 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 AIF-C01 exam.