AI0-001 Implementing AI Solutions Practice Question
An AI application needs to generate structured JSON output from an LLM. The development team wants to ensure the output always conforms to a specific schema. Which prompt engineering technique is MOST suitable?
⚠ Common exam trap
The AI0-001 exam often tests the misconception that few-shot examples alone are sufficient for format control, but the trap here is that without an explicit schema and strict instruction, the model may still produce inconsistent or non-compliant output, especially when the schema is complex or the prompt context shifts.
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
✓
System prompt with JSON schema and a 'respond only with valid JSON' instruction
Providing the JSON schema directly in the system prompt, combined with an explicit instruction to respond only with valid JSON, is the most direct and reliable way to constrain an LLM's output format. This technique leverages the model's instruction-following capability and schema awareness without requiring examples or retraining, ensuring strict adherence to the desired structure.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Few-shot examples showing correct JSON
Why it's wrong here
Few-shot examples help but do not guarantee compliance; the model may still deviate.
- ✓
System prompt with JSON schema and a 'respond only with valid JSON' instruction
Why this is correct
A system prompt with schema and JSON mode enforces structured output reliably.
- ✗
Chain-of-thought prompting
Why it's wrong here
Chain-of-thought improves reasoning but does not enforce a specific output format.
- ✗
Fine-tuning the model on JSON datasets
Why it's wrong here
Fine-tuning is overkill and may not guarantee compliance without additional constraints.
About these practice questions
One of 754 original AI0-001 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 →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AI0-001 practice question is part of Courseiva's free CompTIA 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 AI0-001 exam.