// Numbas version: finer_feedback_settings {"name": "Basic R: Part 2a", "duration": 0, "metadata": {"description": "", "licence": "Creative Commons Attribution 4.0 International"}, "allQuestions": true, "shuffleQuestions": false, "percentPass": 0, "timing": {"allowPause": true, "timeout": {"action": "none", "message": ""}, "timedwarning": {"action": "none", "message": ""}}, "pickQuestions": 0, "navigation": {"onleave": {"action": "none", "message": ""}, "reverse": true, "allowregen": true, "showresultspage": "oncompletion", "preventleave": true, "browse": true, "showfrontpage": true}, "feedback": {"showtotalmark": true, "advicethreshold": 0, "allowrevealanswer": true, "feedbackmessages": [], "showactualmark": true, "showanswerstate": true, "intro": "", "enterreviewmodeimmediately": true, "showexpectedanswerswhen": "inreview", "showpartfeedbackmessageswhen": "always", "showactualmarkwhen": "always", "showtotalmarkwhen": "always", "showanswerstatewhen": "always", "showadvicewhen": "never"}, "type": "exam", "questions": [], "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": [{"name": "Question 6 types of variables", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "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/"}], "functions": {}, "ungrouped_variables": ["a", "type", "possible_values", "logical_values", "double_values", "dataframe_values", "character_values", "value"], "tags": [], "preamble": {"css": "", "js": ""}, "advice": "\n

 

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

What type of variable is $x$?

", "matrix": ["if(type=0,1,0)", "if(type=1,1,0)", "if(type=2,1,0)", "if(type=3,1,0)"], "shuffleChoices": false, "variableReplacements": [], "choices": ["

Character

", "

Logical

", "

Double

", "

Data frame

"], "variableReplacementStrategy": "originalfirst", "maxMarks": "1", "distractors": ["", "", "", ""], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "1_n_2", "displayType": "radiogroup", "minMarks": 0}], "statement": "
> x = {value}
", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"a": {"definition": "random(-10..10#3)", "templateType": "randrange", "group": "Ungrouped variables", "name": "a", "description": ""}, "logical_values": {"definition": "[true,false]", "templateType": "anything", "group": "Ungrouped variables", "name": "logical_values", "description": ""}, "dataframe_values": {"definition": "[repeat(random(-5..5#0.1),5)]", "templateType": "anything", "group": "Ungrouped variables", "name": "dataframe_values", "description": ""}, "possible_values": {"definition": "switch(\n type=0,\n character_values,\n type=1,\n logical_values,\n type=2,\n double_values,\n type=3,\n dataframe_values\n)", "templateType": "anything", "group": "Ungrouped variables", "name": "possible_values", "description": "

Possible values for the given data type

"}, "value": {"definition": "random(possible_values)", "templateType": "anything", "group": "Ungrouped variables", "name": "value", "description": ""}, "character_values": {"definition": "['\"'+random([\"Fred\",\"x\"]+logical_values+double_values)+'\"']", "templateType": "anything", "group": "Ungrouped variables", "name": "character_values", "description": ""}, "double_values": {"definition": "repeat(random(1..10),3)+\nrepeat(random(-10..-1),3)", "templateType": "anything", "group": "Ungrouped variables", "name": "double_values", "description": ""}, "type": {"definition": "random([0,1,2])", "templateType": "anything", "group": "Ungrouped variables", "name": "type", "description": "

0 - character

\n

1 - logical

\n

2 - double

\n

3 - data frame

"}}, "metadata": {"description": "", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Question 10 length of vectors", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "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/"}], "functions": {}, "ungrouped_variables": ["a", "c", "d"], "tags": [], "advice": "

a)

\n

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),', ')}.

\n

length gives the number of elements in a vector. There are $\\var{c}$ elements in x.

\n

x+{d} adds $\\var{d}$ to each element of x, so the resulting vector has the same length.

\n

b)

\n

y is a single number, so length(y) is $1$.

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

What is the value of $y$?

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

{c}

", "

{{c}+{a}+{d}}

", "

{{c}+{d}}

", "

{{a}+{d}}

"], "variableReplacementStrategy": "originalfirst", "displayType": "radiogroup", "maxMarks": "1", "scripts": {}, "distractors": ["", "", "", ""], "marks": 0, "showCorrectAnswer": true, "type": "1_n_2", "minMarks": 0}, {"displayColumns": 0, "prompt": "

What is the value of $z$?

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

{a}

", "

{c}

", "

1

", "

{{c}+{d}}

"], "variableReplacementStrategy": "originalfirst", "displayType": "radiogroup", "maxMarks": "1", "scripts": {}, "distractors": ["", "", "", ""], "marks": 0, "showCorrectAnswer": true, "type": "1_n_2", "minMarks": 0}], "statement": "
> x = seq({a},{c+a-1})
> y = length(x+{d})
> z = length(y)
", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "preamble": {"css": "", "js": ""}, "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": "", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Amy's copy of Question 10 length of vectors", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "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/"}], "functions": {}, "ungrouped_variables": ["a", "c", "d"], "tags": [], "preamble": {"css": "", "js": ""}, "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),', ')}.

\n

length(x) gives the number of elements in x. x has $\\var{c}$ elements.

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

What is the value of $y$?

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

{c+d}

", "

{{c}+{a}+{d}}

", "

{c}

", "

{{a}+{d}}

"], "variableReplacementStrategy": "originalfirst", "maxMarks": "1", "distractors": ["", "", "", ""], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "1_n_2", "displayType": "radiogroup", "minMarks": 0}], "statement": "
> x = seq({a},{c+a-1})
> y = length(x)+{d}
", "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": "", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Amy's second copy of Question 10 length of vectors", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "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/"}], "functions": {}, "ungrouped_variables": ["a", "c", "d"], "tags": [], "preamble": {"css": "", "js": ""}, "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),', ')}.

\n

length(x) gives the number of elements in x. x has $\\var{c}$ elements.

\n

$y = 1/\\operatorname{length}(x) = 1/\\var{c} = \\var{1/c}$

", "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}], "statement": "
> x = seq({a},{c+a-1})
> y = 1/(length(x))
", "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": "", "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/"}], "extensions": [], "custom_part_types": [], "resources": []}