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

a) This function takes a value, in this case $\\var{a}$ and multiplies it by a value $z$ which in this case is $\\var{z}$. Therefore our function gives $\\var{a}\\times\\var{z}=\\var{a*z}$.

\n

b) $x$ has been defined in line 1 and should not be confused with the argument to the function. So, taking the input $\\var{x}$, the function returns $\\var{x}\\times\\var{z}=\\var{x*z}$.

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

What is the value of $y$?

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

{x}

", "

{{x}*{z}}

", "

{{a}*{z}}

", "

{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 $a$?

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

{{x}*{a}}

", "

{{x}*{z}}

", "

{x}

", "

{z}

"], "variableReplacementStrategy": "originalfirst", "maxMarks": "1", "distractors": ["", "", "", ""], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "1_n_2", "displayType": "radiogroup", "minMarks": 0}], "extensions": [], "statement": "
> x = {x}
> fun1 = function(x) {
+ z = {z}
+ return (x*z)
+ }
> y = fun1({a})
> a = fun1(x)
", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"a": {"definition": "random(6..10#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "a", "description": ""}, "x": {"definition": "random(-10..-1#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "x", "description": ""}, "z": {"definition": "random(2..10#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "z", "description": ""}}, "metadata": {"description": "", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}], "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/"}]}