// Numbas version: finer_feedback_settings {"name": "length of vectors", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variablesTest": {"maxRuns": 100, "condition": ""}, "preamble": {"js": "", "css": ""}, "tags": [], "ungrouped_variables": ["a", "c", "d"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "pickQuestions": 0, "name": ""}], "type": "question", "metadata": {"description": "", "licence": "Creative Commons Attribution 4.0 International"}, "variable_groups": [], "advice": "
x
is a vector holding the sequence of numbers between $\\var{a}$ and $\\var{a+c-1}$, inclusive, i.e. {join(list(a..a+c-1),', ')}.
length
gives the number of elements in a vector. There are $\\var{c}$ elements in x
.
x+{d}
adds $\\var{d}$ to each element of x, so the resulting vector has the same length.
y
is a single number, so length(y)
is $1$.
What is the value of $y$?
", "variableReplacementStrategy": "originalfirst", "type": "1_n_2", "distractors": ["", "", "", ""], "variableReplacements": [], "shuffleChoices": true, "minMarks": 0, "scripts": {}, "maxMarks": "1", "showCorrectAnswer": true, "marks": 0, "displayColumns": 0, "choices": ["{c}
", "{{c}+{a}+{d}}
", "{{c}+{d}}
", "{{a}+{d}}
"], "matrix": ["1", 0, 0, 0], "displayType": "radiogroup"}, {"prompt": "What is the value of $z$?
", "variableReplacementStrategy": "originalfirst", "type": "1_n_2", "distractors": ["", "", "", ""], "variableReplacements": [], "shuffleChoices": false, "minMarks": 0, "scripts": {}, "maxMarks": "1", "showCorrectAnswer": true, "marks": 0, "displayColumns": 0, "choices": ["{a}
", "{c}
", "1
", "{{c}+{d}}
"], "matrix": [0, 0, "1", 0], "displayType": "radiogroup"}], "showQuestionGroupNames": false, "statement": "> x = seq({a},{c+a-1})", "variables": {"c": {"description": "", "group": "Ungrouped variables", "name": "c", "definition": "random(4..10#1)", "templateType": "randrange"}, "a": {"description": "", "group": "Ungrouped variables", "name": "a", "definition": "random(1..10#1)", "templateType": "randrange"}, "d": {"description": "", "group": "Ungrouped variables", "name": "d", "definition": "random(1..10#1)", "templateType": "randrange"}}, "rulesets": {}, "functions": {}, "extensions": [], "name": "length of vectors", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Amy Chadwick", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/505/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Amy Chadwick", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/505/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}
> y = length(x+{d})
> z = length(y)