Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Numerical question type

From MoodleDocs

Database tables

quiz_numerical

The quiz_numerical table is an extension of the quiz_answers table, defining a tolerance value for each answer.

id
int(10) unsigned NOT NULL auto_increment,
question
int(10) unsigned NOT NULL default '0',
answer
int(10) unsigned NOT NULL default '0',
tolerance
varchar(255) NOT NULL default '0.0',

quiz_numerical_units

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.

id
int(10) unsigned NOT NULL auto_increment,
question
int(10) unsigned NOT NULL default '0',
multiplier
decimal(40,20) NOT NULL default '1.00000000000000000000',
unit
varchar(50) NOT NULL default ,

Response storage

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.

Question->options

State->options

See also

Numerical formats, gives a proposal for implementing various numerical formats for numerical and calculated question type in Question Engine 2.1.

Numerical tolerances, analysis of the various tolerances for numerical and calculated question type answer (MDL-31837).