// Numbas version: finer_feedback_settings {"name": "Question 11 harder sequences", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {}, "ungrouped_variables": [], "name": "Question 11 harder sequences", "tags": [], "preamble": {"css": "", "js": ""}, "advice": "
First think of length(y)
. This is $5$ because y
is the sequence of numbers between $2$ and $6$, inclusive, i.e. {join(list(2..6),' ')}
.
Then y[3:length(y)]
means extract the third to fifth element of y
, i.e. 4 5 6
.
Similarly, extract the second to third elements of x
because length(x) = 3
.
The rev()
function reverses the order of the given vector.
which(y==4)
gives the index of the first occurrence of $4$ in y
. The third element of y
is $4$ therefore $b=3$.
What is the value of $x$?
", "matrix": [0, 0, "1", 0], "shuffleChoices": false, "variableReplacements": [], "choices": ["2 3 4 5 6
", "3 4 5 6
", "4 5 6
", "3
"], "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": ["5 6
", "4 5
", "4 5 6
", "3 4 5 6
"], "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": ["1", 0, 0, 0], "shuffleChoices": false, "variableReplacements": [], "choices": ["6 5
", "6 5 4
", "4 5 6
", "5 6
"], "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 $b$?
", "matrix": [0, "1", 0, 0], "shuffleChoices": false, "variableReplacements": [], "choices": ["4
", "3
", "2 3
", "6
"], "variableReplacementStrategy": "originalfirst", "maxMarks": "1", "distractors": ["", "", "", ""], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "1_n_2", "displayType": "radiogroup", "minMarks": 0}], "extensions": [], "statement": "> y = seq(2,6)", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {}, "metadata": {"description": "", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}], "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/"}]}]}], "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/"}]}
> x = y[3:length(y)]
> x
> z = x[2:length(x)]
> a = rev(z)
> b = which(y==4)