A <primer-quiz> builds a short test from a bank of questions you author inline, as a child <script type="application/json">. The count attribute says how many questions to show; they're picked at random. Each question is one of two kinds.

1. Multiple choice

Give it options. Exactly one (or more) is marked "correct": true; the options are shuffled for each learner. Prompt and option text may contain inline maths between $…$.

{ "prompt": "Which sum equals $10$?",
  "options": [
    { "text": "$7 + 3$", "correct": true },
    { "text": "$6 + 3$", "correct": false },
    { "text": "$5 + 4$", "correct": false }
  ] }

Live:

2. Free text

Give it an answer instead of options and the learner types into a box. The answer can be a literal (a number, or text like "Paris"): typed answers are graded numerically with a small tolerance, or as case- and space-insensitive text.

{ "prompt": "What is the capital of France?",
  "answer": "Paris" }

Live:

3. Randomised questions

Add variables and the question becomes a template: fresh random numbers each time, with the answer computed from them. A single template can fill several slots, so each learner gets a different set.

{ "prompt": "What is ${a} \\times {b}$?",
  "variables": "a=[2:9] b=[2:9]",
  "answer": "a * b" }

Live (reload the page for new numbers):

That's the whole quiz vocabulary. Mix kinds freely in one bank — the Primer picks count of them and grades whatever the learner answers.