Note: You are currently viewing documentation for Moodle 2.5. Up-to-date documentation for the latest stable version of Moodle may be available here: True/False question type.

Development:True/False question type: Difference between revisions

From MoodleDocs
Line 12: Line 12:
:int(10) unsigned NOT NULL default '0',
:int(10) unsigned NOT NULL default '0',
==Response storage==
==Response storage==
The true/false questiontype stores a single answer id (from the table quiz_answers) in the answer field. Each true/false question defines two answer records, one for the 'true' option, one for the 'false' option, so either of these two ids gets stored as response.
 
Each true/false question defines two answer records, one for the 'true' option, one for the 'false' option. The ids of these answers are stored in the 'trueanswer' and 'falseanswer' field of the quiz_truefalse table.
 
The response from the student in <nowiki>$state->responses['']</nowiki> is the id of the answer chosen by the student. This then also gets stored in the 'answer' field in the quiz_states table.


==Question->options==
==Question->options==

Revision as of 19:53, 21 February 2006

Template:Questiontype developer docs

Database tables

An extension of the quiz_questions table the quiz_truefalse table stores the answer ids for the true and for the false answers.

id
int(10) unsigned NOT NULL auto_increment,
question
int(10) unsigned NOT NULL default '0',
trueanswer
int(10) unsigned NOT NULL default '0',
falseanswer
int(10) unsigned NOT NULL default '0',

Response storage

Each true/false question defines two answer records, one for the 'true' option, one for the 'false' option. The ids of these answers are stored in the 'trueanswer' and 'falseanswer' field of the quiz_truefalse table.

The response from the student in $state->responses[''] is the id of the answer chosen by the student. This then also gets stored in the 'answer' field in the quiz_states table.

Question->options

State->options