# Quiz Schema Used in AI Engineering from Scratch Lessons: Complete Technical Guide

> Understand the quiz schema in AI Engineering from Scratch. This technical guide details the strict JSON structure, question types, and answer indexing for effective learning.

- Repository: [Rohit Ghumare/ai-engineering-from-scratch](https://github.com/rohitg00/ai-engineering-from-scratch)
- Tags: technical-guide
- Published: 2026-08-28

---

**The quiz schema used in AI Engineering from Scratch lessons is a strict JSON structure defined in [`AGENTS.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/AGENTS.md) that requires exactly six questions per lesson—one pre-lesson, three in-lesson checks, and two post-lesson assessments—with fixed multiple-choice options and zero-based indexing for correct answers.**

The `rohitg00/ai-engineering-from-scratch` repository enforces a uniform **quiz schema** across its entire curriculum to ensure consistent rendering and automated validation. This schema governs how every [`quiz.json`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/quiz.json) file must be structured so that the site's lesson renderer can display assessments correctly and curriculum tooling can validate content automatically.

## Core Structure of the AI Engineering Quiz Schema

According to the repository's documentation in [`AGENTS.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/AGENTS.md) (lines 90-101), every [`quiz.json`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/quiz.json) file must contain three top-level fields and a strictly formatted questions array.

### Required Top-Level Fields

- **`lesson`**: A string containing the slug of the lesson directory (e.g., `"32-architect-professional-system-capstone"`).
- **`title`**: A human-readable string representing the lesson title.
- **`questions`**: An array containing exactly **six** question objects.

### Question Object Specification

Each object within the `questions` array must include the following fields:

| Field | Type | Description |
|-------|------|-------------|
| `stage` | string | Must be `"pre"`, `"check"`, or `"post"` indicating when the question appears (pre-lesson, in-lesson checkpoint, or post-lesson). |
| `question` | string | The text of the question being asked. |
| `options` | array | Exactly four strings representing multiple-choice options. |
| `correct` | integer | Zero-based index (0-3) pointing to the correct option in the `options` array. |
| `explanation` | string | Optional text explaining why the correct answer is right. |

## Validation Rules and Constraints

The **quiz schema** imposes strict validation rules that break the site renderer if violated. Legacy formats such as `q/choices/answer` are explicitly unsupported and will cause rendering failures.

### Question Distribution Requirements

You must provide exactly **six questions** in this specific distribution:
- **1 pre-lesson question** (`"stage": "pre"`)
- **3 in-lesson check questions** (`"stage": "check"`)
- **2 post-lesson assessment questions** (`"stage": "post"`)

### Zero-Based Indexing for Answers

The `correct` field uses **zero-based indexing**: valid values are integers 0, 1, 2, or 3 corresponding to the first, second, third, or fourth item in the `options` array. This differs from legacy schemas that might use 1-based numbering.

### Options Array Length

Every question must provide exactly **four options** in the `options` array. The schema does not support variable-length multiple choice; four options are mandatory for every question object.

## Example quiz.json Implementation

Here is a validated [`quiz.json`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/quiz.json) file conforming to the AI Engineering from Scratch schema:

```json
{
  "lesson": "32-architect-professional-system-capstone",
  "title": "Architect Professional System Capstone",
  "questions": [
    {
      "stage": "pre",
      "question": "What is the primary goal of a system capstone project?",
      "options": ["A", "B", "C", "D"],
      "correct": 2,
      "explanation": "Option C outlines the integration of multiple components."
    },
    {
      "stage": "check",
      "question": "Which component handles data routing?",
      "options": ["Router", "Dispatcher", "Mediator", "Broker"],
      "correct": 0,
      "explanation": ""
    },
    {
      "stage": "check",
      "question": "How is observability introduced?",
      "options": ["Logs", "Metrics", "Traces", "All of the above"],
      "correct": 3,
      "explanation": ""
    },
    {
      "stage": "check",
      "question": "What safety gate prevents runaway generation?",
      "options": ["Gate A", "Gate B", "Gate C", "Gate D"],
      "correct": 1,
      "explanation": ""
    },
    {
      "stage": "post",
      "question": "Which metric best reflects end-to-end latency?",
      "options": ["P99", "Mean", "Median", "Max"],
      "correct": 0,
      "explanation": ""
    },
    {
      "stage": "post",
      "question": "What is the recommended way to test the capstone?",
      "options": ["Unit tests", "Integration tests", "System tests", "All of the above"],
      "correct": 3,
      "explanation": ""
    }
  ]
}

```

## File Locations and Repository Structure

The quiz schema is implemented across several locations in the `ai-engineering-from-scratch` repository:

- **[`AGENTS.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/AGENTS.md)**: Contains the canonical schema definition (lines 90-101) and validation documentation (line 105).
- **`phases/*/*/quiz.json`**: Individual lesson quizzes organized by phase and module.
- **`certifications/claude/*/quiz.json`**: Certification-specific assessments using the identical schema.
- **[`skills/learn/SKILL.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/skills/learn/SKILL.md)**: References quiz file locations within skill documentation.

## Summary

- The **quiz schema** requires exactly six questions per lesson: 1 pre, 3 check, and 2 post stages.
- All answers use **zero-based indexing** (0-3) in the `correct` field.
- Each question must provide exactly **four options** in the `options` array.
- The schema is defined in **[`AGENTS.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/AGENTS.md)** and validated against files in `phases/` and `certifications/` directories.
- Legacy formats like `q/choices/answer` will break the site renderer.

## Frequently Asked Questions

### What file defines the quiz schema in AI Engineering from Scratch?

The schema is defined in **[`AGENTS.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/AGENTS.md)** at lines 90-101, which documents the required fields, types, and validation rules for all [`quiz.json`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/quiz.json) files in the curriculum.

### How many questions must each quiz.json contain?

Every [`quiz.json`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/quiz.json) must contain exactly **six questions**: one pre-lesson question, three in-lesson check questions, and two post-lesson assessment questions. This distribution is enforced by the curriculum validators.

### Why does the schema use zero-based indexing for correct answers?

The `correct` field uses zero-based indexing (0-3) to align with JavaScript array indexing conventions used by the site's rendering engine. This means `correct: 0` refers to the first item in the `options` array, not the second.

### Where are the actual quiz files stored in the repository?

Lesson quizzes are stored in **`phases/*/*/quiz.json`** following the directory structure of the curriculum. Certification quizzes use the same schema and are located in **`certifications/claude/*/quiz.json`**.