// Numbas version: exam_results_page_options {"name": "Ask for the sum of the elements the student picked", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"type": "question", "variables": {"numbers": {"name": "numbers", "description": "

Numbers shown to the student to pick from

", "templateType": "anything", "definition": "shuffle(1..10)[0..4]", "group": "Ungrouped variables"}, "total": {"name": "total", "description": "", "templateType": "anything", "definition": "sum(chosen_numbers)", "group": "Ungrouped variables"}, "chosen": {"name": "chosen", "description": "

Element i says whether option i has been ticked

", "templateType": "anything", "definition": "[true,true,false,false]", "group": "Ungrouped variables"}, "chosen_numbers": {"name": "chosen_numbers", "description": "

The values of the numbers ticked by the student

", "templateType": "anything", "definition": "map(\n numbers[n],\n n,\n filter(chosen[j],j,0..3) // filter out indices which weren't picked\n)", "group": "Ungrouped variables"}}, "variable_groups": [], "name": "Ask for the sum of the elements the student picked", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Student is given a few numbers to choose from. They must pick at least two, and then give the sum of their chosen numbers.

"}, "variablesTest": {"maxRuns": 100, "condition": ""}, "parts": [{"showFeedbackIcon": true, "type": "gapfill", "scripts": {}, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "showCorrectAnswer": true, "gaps": [{"displayType": "checkbox", "distractors": ["", "", "", ""], "scripts": {}, "variableReplacementStrategy": "originalfirst", "choices": ["

{numbers[0]}

", "

{numbers[1]}

", "

{numbers[2]}

", "

{numbers[3]}

"], "minAnswers": "2", "type": "m_n_2", "showCorrectAnswer": false, "matrix": ["1", "1", "1", "1"], "showFeedbackIcon": true, "minMarks": 0, "shuffleChoices": false, "warningType": "none", "maxAnswers": "2", "maxMarks": 0, "displayColumns": 0, "variableReplacements": [], "marks": 0}], "prompt": "

Pick at least two numbers

\n

[[0]]

", "marks": 0}, {"showFeedbackIcon": true, "type": "gapfill", "scripts": {}, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "showCorrectAnswer": true, "gaps": [{"variableReplacements": [{"part": "p0g0", "must_go_first": false, "variable": "chosen"}], "scripts": {}, "variableReplacementStrategy": "alwaysreplace", "mustBeReducedPC": 0, "showCorrectAnswer": true, "type": "numberentry", "mustBeReduced": false, "maxValue": "total", "showFeedbackIcon": true, "correctAnswerStyle": "plain", "allowFractions": false, "notationStyles": ["plain", "en", "si-en"], "minValue": "total", "correctAnswerFraction": false, "marks": 1}], "prompt": "

Write the sum of the numbers you chose.

\n

[[0]]

", "marks": 0}], "functions": {}, "tags": ["demo"], "extensions": [], "preamble": {"css": "", "js": ""}, "ungrouped_variables": ["numbers", "chosen", "chosen_numbers", "total"], "statement": "", "advice": "", "rulesets": {}, "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/"}]}