// Numbas version: exam_results_page_options {"name": "MATLAB CBA2 Question 4 (credit: Amy Chadwick)", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {}, "ungrouped_variables": ["a", "c", "d"], "name": "MATLAB CBA2 Question 4 (credit: Amy Chadwick)", "tags": [], "preamble": {"css": "", "js": ""}, "advice": "

a) $x$ is a vector of length {c} because it is a sequence between {a} and {c+a}, i.e. there is one element for each value between and including {a} and {a+c}.  

\n

b) $y$ has length 1 as it is just one number. Now, length(y+2) is actually length({1/c +2}) = 1  as  {1/c +2}  is just a scalar.

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

What is the value of $y$?

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

{1/c}

", "

{1/({c}+{a}+{d})}

", "

{{c}+{d}}

", "

{c}

"], "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": [0, "1", 0, "0"], "shuffleChoices": true, "variableReplacements": [], "choices": ["

0

", "

1

", "

{1/c + 2}

", "

3

"], "variableReplacementStrategy": "originalfirst", "maxMarks": "1", "distractors": ["", "", "", ""], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "1_n_2", "displayType": "radiogroup", "minMarks": 0}], "extensions": [], "statement": "
>> x = {a}:{c+a-1}
>> y = 1/(length(x))
>> z= length(y+2)
", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"a": {"definition": "random(1..10#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "a", "description": ""}, "c": {"definition": "random(4..10#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "c", "description": ""}, "d": {"definition": "random(1..10#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "d", "description": ""}}, "metadata": {"description": "

Question 4 of CBA 2;  Testing the length operator.

", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}], "contributors": [{"name": "Tim English", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/838/"}]}]}], "contributors": [{"name": "Tim English", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/838/"}]}