// Numbas version: finer_feedback_settings {"name": "Question 5 what is x", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {}, "ungrouped_variables": ["y"], "name": "Question 5 what is x", "tags": [], "preamble": {"css": "", "js": ""}, "advice": "
a) Line 1 assigns $y=\\var{y}$.
\nLine 2 assigns $x=\\var{y+2}$.
\nLine 3 reassigns $x$ using $x=\\var{y+2}$. Therefore $x=\\var{y+y+2+2}$.
\nb) Line 5 sets $z = x + x$ but then line 6 reassigns $z$ using the previous $z$ value.
", "rulesets": {}, "parts": [{"prompt": "What is the value of $x$?
", "matrix": ["1", 0, 0, 0], "shuffleChoices": false, "scripts": {}, "choices": ["{y+2+y+2}
", "{y+2}
", "{y+y}
", "{2}
"], "marks": 0, "displayType": "radiogroup", "maxMarks": "1", "distractors": ["", "", "", ""], "displayColumns": 0, "showCorrectAnswer": true, "type": "1_n_2", "minMarks": 0}, {"prompt": "What is the value of $z$?
", "matrix": ["0", 0, 0, "1"], "shuffleChoices": false, "scripts": {}, "choices": ["{16*y+32}
", "{4*y+8}
", "{3*y+6}
", "{8*y+16}
"], "marks": 0, "displayType": "radiogroup", "maxMarks": "1", "distractors": ["", "", "", ""], "displayColumns": 0, "showCorrectAnswer": true, "type": "1_n_2", "minMarks": 0}], "statement": "> y = {y}", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"y": {"definition": "random(2..10#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "y", "description": ""}}, "metadata": {"notes": "", "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/"}]}
> x = y + 2
> x = x + x
> x
> z = x + x
> z = z + z