AI-102 Implement generative AI solutions Practice Question
You are prototyping a chat experience on Azure OpenAI and want the model to produce structured JSON that matches a schema your application can deserialize reliably. Which feature should you configure?
⚠ Common exam trap
The trap here is believing that setting temperature to zero or naming JSON in the prompt guarantees valid JSON, when only schema-constrained decoding enforces the contract.
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
✓
Set response_format to json_schema with a strict schema definition on the chat completions call.
Schema-constrained generation is the only option that enforces structure at decode time. Configuring response_format with a strict JSON schema makes the model emit payloads that conform to the defined fields and types, so the application can deserialize without defensive parsing. Sampling parameters, prompt hints, and content filters do not enforce schema conformance.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Enable content filtering and set the severity threshold to high.
Why it's wrong here
Content filtering evaluates whether output contains harmful categories; it has no concept of JSON syntax or schema conformance. A perfectly safe response can still be invalid JSON, and raising thresholds may block legitimate content. This setting is unrelated to producing structured, deserializable output.
- ✗
Increase top_p to 1 and rely on the model's instruction-following ability.
Why it's wrong here
top_p controls nucleus sampling breadth and does not enforce output structure. Leaving it at 1 keeps the full probability mass available, which can introduce formatting variance rather than remove it. Instruction-following helps, but without schema enforcement the model may still add explanatory text or omit required fields, breaking the client parser.
- ✓
Set response_format to json_schema with a strict schema definition on the chat completions call.
Why this is correct
Structured outputs with a strict JSON schema constrain generation so the response conforms to the supplied schema, which makes deserialization dependable. This is the purpose-built mechanism for schema-constrained JSON in chat completions and is more reliable than prompt-only instructions, because the model is constrained during decoding rather than merely asked to comply.
- ✗
Set temperature to 0 and add the word JSON to the user prompt.
Why it's wrong here
Temperature zero reduces randomness but does not guarantee valid JSON; the model can still emit trailing commas, prose preambles, or fields that violate the schema. Mentioning JSON in the prompt is a soft hint that frequently works but is not enforced, so a malformed payload can still break deserialization in production.
Go deeper
Related to this question
About these practice questions
Courseiva writes every AI-102 question from scratch — 761 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 →
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 Microsoft exam blueprint
This AI-102 practice question is part of Courseiva's free Microsoft 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 AI-102 exam.