Numbas generic runtime demo

This page demonstrates how to use the Numbas generic runtime.

See the documentation on embedding Numbas content in other pages.

Load an exam from a URL

HTML code for this example
<numbas-exam source_url="exams/easy-question.exam"></numbas-exam>

Give an exam definition inline

HTML code for this example
<numbas-exam>
<script type="application/numbas-exam">
{
    "name": "Easy question",
    "navigation": { "showfrontpage": false, "preventleave": false },
    "question_groups": [{
        "questions": [{
            "name": "Easy question",
            "variables": {
                "n": {
                    "name": "n",
                    "definition": "random(100 .. 999#1)"
                }
            },
            "parts": [{
                "type": "numberentry",
                "prompt": "<p>Write {n}.</p>",
                "marks": 1,
                "minValue": "n",
                "maxValue": "n"
            }]
        }]
    }]
}
</script>
</numbas-exam>