{ "source": { "author": { "name": "Christian Lawson-Perfect" } }, "name": "True or False", "short_name": "true-or-false", "description": "
The student must write T or True for 'true', or F or False for 'false'. (Case doesn't matter)
", "help_url": "", "input_widget": "string", "input_options": { "correctAnswer": "if(eval(settings[\"is_true\"]),settings[\"true_words\"][0],settings[\"false_words\"][0])", "hint": { "static": true, "value": "" }, "allowEmpty": { "static": true, "value": false } }, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\napply(interpreted_answer);\napply(is_correct)\n\ninterpreted_answer:\nswitch(\n cleaned_studentAnswer in true_words,\n true,\n cleaned_studentAnswer in false_words,\n false,\n // otherwise\n warn(\"Write \"+settings[\"true_words\"][0]+\" or \"+settings[\"false_words\"][0]);\n fail(\"Write \"+settings[\"true_words\"][0]+\" or \"+settings[\"false_words\"][0])\n)\n\n\nis_correct:\ncorrectif(interpreted_answer=should_be_true)\n\ntrue_words:\nmap(lower(trim(x)),x,settings[\"true_words\"])\n\nfalse_words:\nmap(lower(trim(x)),x,settings[\"false_words\"])\n\ncleaned_studentAnswer:\nlower(trim(studentAnswer))\n\nshould_be_true:\neval(settings[\"is_true\"])", "marking_notes": [ { "name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "apply(interpreted_answer);\napply(is_correct)" }, { "name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "switch(\n cleaned_studentAnswer in true_words,\n true,\n cleaned_studentAnswer in false_words,\n false,\n // otherwise\n warn(\"Write \"+settings[\"true_words\"][0]+\" or \"+settings[\"false_words\"][0]);\n fail(\"Write \"+settings[\"true_words\"][0]+\" or \"+settings[\"false_words\"][0])\n)\n" }, { "name": "is_correct", "description": "", "definition": "correctif(interpreted_answer=should_be_true)" }, { "name": "true_words", "description": "", "definition": "map(lower(trim(x)),x,settings[\"true_words\"])" }, { "name": "false_words", "description": "", "definition": "map(lower(trim(x)),x,settings[\"false_words\"])" }, { "name": "cleaned_studentAnswer", "description": "", "definition": "lower(trim(studentAnswer))" }, { "name": "should_be_true", "description": "", "definition": "eval(settings[\"is_true\"])" } ], "settings": [ { "name": "is_true", "label": "Is the answer 'true'?", "help_url": "", "hint": "An expression which evaluates totrue or false.",
"input_type": "mathematical_expression",
"default_value": "true",
"subvars": false
},
{
"name": "true_words",
"label": "Words to interpret as 'true'",
"help_url": "",
"hint": "Any of the words in this list will be interpreted as \"True\"",
"input_type": "list_of_strings",
"default_value": [
"T",
"True"
],
"subvars": true
},
{
"name": "false_words",
"label": "Words to interpret as 'false'",
"help_url": "",
"hint": "Any of the words in this list will be interpreted as \"False\".",
"input_type": "list_of_strings",
"default_value": [
"F",
"False"
],
"subvars": true
}
],
"public_availability": "always",
"published": true,
"extensions": []
}