// Numbas version: exam_results_page_options {"name": "Quantities", "extensions": ["quantities"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variablesTest": {"condition": "", "maxRuns": 100}, "functions": {}, "metadata": {"description": "

Fiddling about with a new extension providing a \"quantity\" data type: an amount with units.

", "licence": "Creative Commons Attribution 4.0 International"}, "advice": "", "preamble": {"css": "", "js": ""}, "tags": [], "name": "Quantities", "ungrouped_variables": ["density", "volume", "mass", "units"], "rulesets": {}, "parts": [{"prompt": "

What is the object's density, in SI units?

", "customMarkingAlgorithm": "student_quantity:\n quantity(studentanswer)\n\ncorrect_quantity:\n tobase(density)\n\ncompatible:\n assert(compatible(student_quantity,correct_quantity),\n incorrect(\"Your answer does not have the correct dimensions.\");\n end();\n false\n )\n\nstudent_base:\n tobase(student_quantity)\n\nsame_units:\n assert(units(student_quantity)=units(correct_quantity),\n feedback(\"Your answer is not in the expected units.\");\n false\n )\n\nis_base_units:\n assert(isbase(student_quantity),\n feedback(\"Your answer is not in SI units.\");\n false\n )\n\nmark:\n apply(compatible);\n apply(same_units);\n apply(is_base_units);\n correctif(student_quantity=correct_quantity)\n\ninterpreted_answer:\n student_quantity", "scripts": {}, "answer": "{string(density)}", "unitTests": [], "matchMode": "exact", "marks": 1, "showCorrectAnswer": true, "type": "patternmatch", "variableReplacements": [], "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "displayAnswer": "{string(tobase(density))}", "extendBaseMarkingAlgorithm": false}], "variables": {"units": {"definition": "quantity(random([\"kg\",\"g\",\"lb\",\"mg\",\"ug\"]))", "name": "units", "description": "", "templateType": "anything", "group": "Ungrouped variables"}, "mass": {"definition": "as(units,density*volume)", "name": "mass", "description": "", "templateType": "anything", "group": "Ungrouped variables"}, "volume": {"definition": "random(300..500#100)*quantity(\"m^3\")", "name": "volume", "description": "", "templateType": "anything", "group": "Ungrouped variables"}, "density": {"definition": "random(1..10)*quantity(\"g/m^3\")", "name": "density", "description": "", "templateType": "anything", "group": "Ungrouped variables"}}, "variable_groups": [], "extensions": ["quantities"], "statement": "

An object has mass {mass} and volume {volume}.

\n

Its density is {density}.

", "type": "question", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}