# Numerical question developer docs

<div class="mw-content-ltr mw-parser-output" dir="ltr" id="bkmrk-template%3Aquestiontyp" lang="en">

- [<span class="tocnumber">1</span> <span class="toctext">Database tables</span>](#bkmrk-database-tables)
    - [<span class="tocnumber">1.1</span> <span class="toctext">quiz\_numerical</span>](#bkmrk-quiz_numerical)
    - [<span class="tocnumber">1.2</span> <span class="toctext">quiz\_numerical\_units</span>](#bkmrk-quiz_numerical_units-1)
- [<span class="tocnumber">2</span> <span class="toctext">Response storage</span>](#bkmrk-response-storage)
- [<span class="tocnumber">3</span> <span class="toctext">Question-&gt;options</span>](#bkmrk-question-%3Eoptions)
- [<span class="tocnumber">4</span> <span class="toctext">State-&gt;options</span>](#bkmrk-state-%3Eoptions)
- [<span class="tocnumber">5</span> <span class="toctext">See also</span>](#bkmrk-see-also)

</div>## <span class="mw-headline" id="bkmrk-database-tables">Database tables</span>

### <span class="mw-headline" id="bkmrk-quiz_numerical">quiz\_numerical</span>

The quiz\_numerical table is an extension of the quiz\_answers table, defining a tolerance value for each answer.

<dl id="bkmrk-id-int%2810%29-unsigned-"><dt>id</dt><dd>int(10) unsigned NOT NULL auto\_increment,</dd><dt>question</dt><dd>int(10) unsigned NOT NULL default '0',</dd><dt>answer</dt><dd>int(10) unsigned NOT NULL default '0',</dd><dt>tolerance</dt><dd>varchar(255) NOT NULL default '0.0',</dd></dl>### <span class="mw-headline" id="bkmrk-quiz_numerical_units-1">quiz\_numerical\_units</span>

The quiz\_numerical\_units table is used by the numerical questiontype and the calculated questionype. It extends the quiz\_questions table, defining an arbitrary number of units that can be used in the responses.

<dl id="bkmrk-id-int%2810%29-unsigned--1"><dt>id</dt><dd>int(10) unsigned NOT NULL auto\_increment,</dd><dt>question</dt><dd>int(10) unsigned NOT NULL default '0',</dd><dt>multiplier</dt><dd>decimal(40,20) NOT NULL default '1.00000000000000000000',</dd><dt>unit</dt><dd>varchar(50) NOT NULL default *,*</dd></dl>## <span class="mw-headline" id="bkmrk-response-storage">Response storage</span>

The numerical questiontype, which inherits the function print\_question\_formulation\_and\_controls() from the shortanswer questiontype, has only one response field, so its responses are handled by the default questiontype. The response is stored without any modifications in the answer field of the table quiz\_states.

## <span class="mw-headline" id="bkmrk-question-%3Eoptions">Question-&gt;options</span>

## <span class="mw-headline" id="bkmrk-state-%3Eoptions">State-&gt;options</span>

## <span class="mw-headline" id="bkmrk-see-also">See also</span>

[Numerical formats](https://docs.moodle.org/503/en/Development:Question_Engine_2:Numerical_formats "Development:Question Engine 2:Numerical formats"), gives a proposal for implementing various numerical formats for numerical and calculated question type in Question Engine 2.1.

---

<small>Source: [docs.moodle.org/503/en/Numerical question developer docs](https://docs.moodle.org/503/en/Numerical%20question%20developer%20docs) — MoodleDocs (GPL) · Imported 2026-11-10.</small>