// Numbas version: exam_results_page_options {"name": "Question 19 function", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {}, "ungrouped_variables": ["a", "x", "b", "k"], "name": "Question 19 function", "tags": [], "preamble": {"css": "", "js": ""}, "advice": "

Don't be confused by the function stating $x=\\var{x}$. This just represents the default of the function. So if you type fun1(), the function will set $x=\\var{x}$ and return ${\\var{b*x}}$.

\n

a) Our function returns $\\var{b}\\times\\var{a}=\\var{a*b}$.

\n

b) We are given $k=\\var{k}$. Our function takes $\\var{b}\\times k =\\var{b*k}$ as input and returns $\\var{b*k}\\times\\var{b}=\\var{k*b*b}$.

", "rulesets": {}, "parts": [{"displayColumns": 0, "prompt": "

What is the value of $y$?

", "matrix": [0, 0, "1", 0], "shuffleChoices": false, "variableReplacements": [], "choices": ["

{x}

", "

{{x}*{b}}

", "

{{b}*{a}}

", "

{{x}*{a}}

"], "variableReplacementStrategy": "originalfirst", "maxMarks": "1", "distractors": ["", "", "", ""], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "1_n_2", "displayType": "radiogroup", "minMarks": 0}, {"displayColumns": 0, "prompt": "

What is the value of $z$?

", "matrix": ["1", 0, 0, 0], "shuffleChoices": false, "variableReplacements": [], "choices": ["

{{b}*{b}*{k}}

", "

{{b}*{k}}

", "

{{k}*{a}}

", "

{x}

"], "variableReplacementStrategy": "originalfirst", "maxMarks": "1", "distractors": ["", "", "", ""], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "1_n_2", "displayType": "radiogroup", "minMarks": 0}], "extensions": [], "statement": "
> fun1 = function(x={x}) {
+ return({b}*x)
+ }
> y = fun1({a})
> k = {k}
> z = fun1({b}*k)
", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"a": {"definition": "random(5..10#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "a", "description": ""}, "x": {"definition": "random(-5..-1#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "x", "description": ""}, "k": {"definition": "random(2..4#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "k", "description": ""}, "b": {"definition": "random(2..4#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "b", "description": ""}}, "metadata": {"description": "", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "contributors": [{"name": "Amy Chadwick", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/505/"}]}]}], "contributors": [{"name": "Amy Chadwick", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/505/"}]}