Skip to content

Latest commit

 

History

History
86 lines (76 loc) · 2.77 KB

File metadata and controls

86 lines (76 loc) · 2.77 KB

Short Quiz Creation Guide

General information:

YAQA uses JSON format for generating quizzes. Each question is stored as a JSON object in an array. To add, delete, or modify quiz questions, you just need to edit the JSON source.

Example quiz json:

[
    {
        "type": "true/false",
        "difficulty": "hard",
        "question": "Is 1 = 1?",
        "answer": true
    },
    {
        "type": "multiple-choice",
        "difficulty": "expert",
        "question": "The answer is A",
        "choices": ["Answer A","Answer B","Answer C","Answer D"],
        "answer": "Answer A"
    }
]

Entire example quiz is available here.

Question properties:

Field Data Type Required Options Description
type string Yes "flashcard", "one-line", "true/false", "multiple-choice" Defines the type of question.
difficulty string Yes - easy, medium, hard, expert Represents the difficulty level of the question.
question string Yes "How much is 2+2?" Defines the question text.
choices array Only for multiple-choice type ["Choice A", "Choice B" ... ] Optional property for multiple-choice questions, containing the answer options.
answer string or boolean Yes "The capital of France is Paris" Defines the correct answer to the question. For true/false questions, it's a boolean value (true or false).

Examples for each type:

Flashcard

{
    "type": "flashcard",
    "difficulty": "expert",
    "question": "What is the capital of Australia?",
    "answer": "No it's not Sydney. It is Canberra"
}

One line question

{
    "type": "one-line",
    "difficulty": "medium",
    "question": "How is called our galaxy?",
    "answer": "Milky Way"
}

True/False question

{
    "type": "true/false",
    "difficulty": "easy",
    "question": "Is 1 = 1?",
    "answer": true
}

Multiple choice question

{
    "type": "multiple-choice",
    "difficulty": "hard",
    "question": "Who invented Git?",
    "choices": ["Elon Musk","Richard Stallman","Linus Torvalds","Microsoft"],
    "answer": "Linus Torvalds"
}

Validation Rules

  • Ensure that the type field is one of the specified options.
  • The difficulty field should be one of easy, medium, hard, or expert. But it can also contain other value if you want.
  • The question field must be a non-empty string.
  • For multiple-choice questions, the choices field must be an array of strings with at least two options.
  • The answer field must match the type of question (boolean for true/false question and string for other ones).
  • Overall quiz json must be properly formatted to avoid any errors.