// Numbas version: exam_results_page_options {"name": "Several variables corresponding to a scenario", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variablesTest": {"maxRuns": 100, "condition": ""}, "rulesets": {}, "variables": {"percents_like_chocolate": {"definition": "[ 12, 34, 45, 82, 71 ]", "group": "Data", "description": "", "templateType": "list of numbers", "name": "percents_like_chocolate"}, "percent_like_chocolate": {"definition": "percents_like_chocolate[scenario]", "group": "Chosen scenario", "description": "", "templateType": "anything", "name": "percent_like_chocolate"}, "city": {"definition": "cities[scenario]", "group": "Chosen scenario", "description": "", "templateType": "anything", "name": "city"}, "populations": {"definition": "[ 58560, 24064, 12064, 10459, 132512 ]", "group": "Data", "description": "", "templateType": "list of numbers", "name": "populations"}, "scenario": {"definition": "random(0..len(cities)-1)", "group": "Chosen scenario", "description": "", "templateType": "anything", "name": "scenario"}, "population": {"definition": "populations[scenario]", "group": "Chosen scenario", "description": "", "templateType": "anything", "name": "population"}, "num_like_chocolate": {"definition": "round(population*percent_like_chocolate/100)", "group": "Chosen scenario", "description": "", "templateType": "anything", "name": "num_like_chocolate"}, "cities": {"definition": "[ \"Lowestoft\", \"Bognor Regis\", \"Maryport\", \"Fort William\", \"Norwich\" ]", "group": "Data", "description": "", "templateType": "list of strings", "name": "cities"}}, "functions": {}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Choose from one of several pre-defined scenarios, and set variables to the corresponding values, defined in lists.

\n

This question has three variables: city, population, and percent_like_chocolate. These differ for each city. We've defined a list for each variable, with the corresponding values. A variable called scenario picks a random position in the list, so the value of city, for example, is cities[scenario].

"}, "tags": [], "advice": "

Multiply the population by the percentage:

\n

\\[ \\var{latex(separateThousands(population,',\\\\!'))} \\times \\var{percent_like_chocolate}\\% = \\var{num_like_chocolate} \\]

", "name": "Several variables corresponding to a scenario", "parts": [{"precisionType": "dp", "variableReplacements": [], "allowFractions": false, "showCorrectAnswer": true, "prompt": "

{percent_like_chocolate}% of the residents of {city} like chocolate.

\n

How many people in {city} like chocolate?

", "precisionMessage": "You have not given your answer to the correct precision.", "precisionPartialCredit": 0, "scripts": {}, "marks": 1, "notationStyles": ["plain", "en", "si-en"], "showPrecisionHint": true, "strictPrecision": false, "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "precision": 0, "showFeedbackIcon": true, "type": "numberentry", "minValue": "num_like_chocolate", "correctAnswerStyle": "plain", "maxValue": "num_like_chocolate"}], "preamble": {"css": "", "js": ""}, "ungrouped_variables": [], "statement": "

Mary lives in {city}. The population of {city} is {separateThousands(population,\",\")}.

", "extensions": [], "type": "question", "variable_groups": [{"variables": ["cities", "populations", "percents_like_chocolate"], "name": "Data"}, {"variables": ["scenario", "city", "population", "percent_like_chocolate", "num_like_chocolate"], "name": "Chosen scenario"}], "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/"}]}