Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/0xchriswilder/journey/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Quiz types define interactive assessments with multiple-choice questions, correct answers, and explanations.

Types

Quiz

Represents a quiz attached to a lesson.
title
string
required
Quiz titleExample: “FHE Fundamentals Quiz”, “First Contract Quiz”
description
string
required
Brief description of what the quiz coversExample: “Test your understanding of FHE and FHEVM basics”
questions
QuizQuestion[]
required
Array of quiz questions
passingScore
number
required
Minimum percentage required to pass (0-100)Example: 70 (70% required to pass)

QuizQuestion

A single multiple-choice question.
id
number | string
required
Unique identifier for the question
question
string
required
The question textExample: “What does FHE stand for?”
options
string[]
required
Array of answer choices (typically 4 options)Example:
[
  "Fully Homomorphic Encryption",
  "Fast Hash Encryption",
  "Federated Hash Encryption",
  "Fully Hybrid Encryption"
]
correctAnswer
number
required
Zero-based index of the correct answer in the options arrayExample: 0 (first option is correct)
explanation
string
required
Explanation shown after answering, clarifying why the correct answer is rightExample: “FHE stands for Fully Homomorphic Encryption, which allows computation on encrypted data without decrypting it.”
category
string
Optional category for grouping questionsExample: “fhe_concept”, “access_control”, “operations”, “testing”

Type Definitions

export interface Quiz {
  title: string;
  description: string;
  questions: QuizQuestion[];
  passingScore: number; // percentage
}

export interface QuizQuestion {
  id: number | string;
  question: string;
  options: string[];
  correctAnswer: number;
  explanation: string;
  category?: string;
}

Usage Example

import { curriculum } from '@/data/curriculum';

// Access quiz from first lesson
const firstLesson = curriculum.weeks[0].lessons[0];
const quiz = firstLesson.quiz;

if (quiz) {
  console.log(quiz.title); // "FHE Fundamentals Quiz"
  console.log(`Passing score: ${quiz.passingScore}%`);
  console.log(`Total questions: ${quiz.questions.length}`);
  
  // Display first question
  const q = quiz.questions[0];
  console.log(`Q${q.id}: ${q.question}`);
  
  q.options.forEach((option, index) => {
    const marker = index === q.correctAnswer ? '✓' : ' ';
    console.log(`${marker} ${index + 1}. ${option}`);
  });
  
  console.log(`Explanation: ${q.explanation}`);
  console.log(`Category: ${q.category}`);
}

// Calculate score
function gradeQuiz(userAnswers: number[]): number {
  if (!quiz) return 0;
  
  const correct = quiz.questions.filter(
    (q, idx) => q.correctAnswer === userAnswers[idx]
  ).length;
  
  const score = (correct / quiz.questions.length) * 100;
  const passed = score >= quiz.passingScore;
  
  return score;
}

// Example: User answered [0, 2, 1, 0, 1]
const score = gradeQuiz([0, 2, 1, 0, 1]);
console.log(`Score: ${score}%`);

Quiz Question Example

const exampleQuestion: QuizQuestion = {
  id: 1,
  question: "What does FHE stand for?",
  options: [
    "Fully Homomorphic Encryption",
    "Fast Hash Encryption",
    "Federated Hash Encryption",
    "Fully Hybrid Encryption"
  ],
  correctAnswer: 0,
  explanation: "FHE stands for Fully Homomorphic Encryption, which allows computation on encrypted data without decrypting it.",
  category: "fhe_concept"
};

Build docs developers (and LLMs) love