// Numbas version: finer_feedback_settings {"name": "Basic R: Part 3", "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": false, "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 12 TRUE/FALSE", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Amy Chadwick", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/505/"}], "functions": {}, "ungrouped_variables": [], "tags": [], "preamble": {"css": "", "js": ""}, "advice": "

a) The line

\n
z = x & !y
\n

tells us that $z$ is true if $x$ is true and $y$ is false.

\n

b) It follows from part (a) that $a$ is true if $z$ is false and $a$ is false if $z$ is true.

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

What is the value of $z$?

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

TRUE

", "

FALSE

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

TRUE

", "

FALSE

"], "variableReplacementStrategy": "originalfirst", "maxMarks": "1", "distractors": ["", ""], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "1_n_2", "displayType": "radiogroup", "minMarks": 0}], "statement": "
> x = TRUE
> y = FALSE
> z = x & !y
> a = !z
", "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": []}]}, {"name": "Question 13 TRUE/FALSE", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Amy Chadwick", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/505/"}], "functions": {}, "ungrouped_variables": ["a"], "tags": [], "preamble": {"css": "", "js": ""}, "advice": "

We are given that x = TRUE, y = FALSE.

The line

\n

x = (y|!y) & x

\n

says, x is true if both of the following are true: y is either true or false, and x is true.

\n

Then,

\n

z = x

sets $z$ to be equal to $x$, hence its earlier value is irrelevant.

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

What is the value of $z$?

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

{a}

", "

FALSE

", "

TRUE

"], "variableReplacementStrategy": "originalfirst", "maxMarks": "1", "distractors": ["", "", ""], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "1_n_2", "displayType": "radiogroup", "minMarks": 0}], "statement": "
> x = TRUE
> y = FALSE
> z = {a}
> x = (y|!y) & x
> z = x
", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"a": {"definition": "random(-20..20#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "a", "description": ""}}, "metadata": {"description": "", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Question 14 Sequences selecting greater than etc", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Amy Chadwick", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/505/"}], "functions": {}, "ungrouped_variables": [], "tags": [], "preamble": {"css": "", "js": ""}, "advice": "

$x$ is a sequence between -2 and 10.

\n

$z$ selects the values from $x$ that are greater than or equal to 7.

\n

$y$ selects the values from $x$ that are greater than or equal to 7 OR less than 0.

\n

$a$ selects the elements of $y$ that are equal to -2. So if $y$ = -2 -1 7 8 9 10 it is the first element that is equal to -2.

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

What is the value of $z$?

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

TRUE

", "

7 8 9 10

", "

0 1 2 3 4 5 6

", "

FALSE TRUE TRUE

"], "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 $y$?

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

-2 -1 7 8 9 10

", "

TRUE

", "

7 8 9 10

", "

-2 -1

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

-2

", "

4

", "

1

", "

TRUE

"], "variableReplacementStrategy": "originalfirst", "maxMarks": "1", "distractors": ["", "", "", ""], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "1_n_2", "displayType": "radiogroup", "minMarks": 0}], "statement": "
> x = seq(-2, 10)
> z = x[(x >= 7) ]
> y = x[(x >= 7) | x < 0]
> a = which(y==-2)
", "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": []}]}, {"name": "Amy's copy of Question 14 Sequences selecting greater than etc", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Amy Chadwick", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/505/"}], "functions": {}, "ungrouped_variables": [], "tags": [], "preamble": {"css": "", "js": ""}, "advice": "

$x$ is a sequence between -5 and 5.

\n

$z$ selects the values from $x$ that are less than -2.

\n

$y$ selects the values from $x$ that are greater than or equal to 3 OR less than -2.

\n

$a$ selects the indices of the value in $z$ that is equal to -3. So if $z$ = -5 -4 -3 it is the third indices that is equal to -3.

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

What is the value of $z$?

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

TRUE

", "

-5 -4 -3

", "

-5 -4 -3 -2

", "

FALSE TRUE TRUE

"], "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 $y$?

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

-5 -4 -3 3 4 5

", "

TRUE

", "

3 4 5

", "

-5 -4 -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 $a$?

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

3

", "

-5 -4 -3

", "

-3

", "

TRUE

"], "variableReplacementStrategy": "originalfirst", "maxMarks": "1", "distractors": ["", "", "", ""], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "1_n_2", "displayType": "radiogroup", "minMarks": 0}], "statement": "
> x = seq(-5, 5)
> z = x[(x < -2) ]
> y = x[(x >= 3) | x < -2]
> a = which(z==-3)
", "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": []}]}, {"name": "Question 15 what type of variable", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Amy Chadwick", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/505/"}], "functions": {}, "ungrouped_variables": [], "tags": [], "preamble": {"css": "", "js": ""}, "advice": "

a) To check this use the command 'is.data.frame(m1)'

\n

b) To check this use the commands 'is.vector(m2)' to show m2 is a vector and then 'is.logical(m2)' to show it is logical.

", "rulesets": {}, "parts": [{"distractors": ["", "", "", ""], "prompt": "

What type of variable is m1?

", "matrix": [0, 0, 0, "1"], "shuffleChoices": false, "scripts": {}, "choices": ["

A vector of doubles

", "

A vector of Logical

", "

A vector of string

", "

A dataframe

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

What type of variable is m2?

", "matrix": [0, "1", 0, 0], "shuffleChoices": false, "scripts": {}, "choices": ["

A vector of doubles

", "

A vector of Logicals

", "

A vector of string

", "

A data frame

"], "displayType": "radiogroup", "maxMarks": "1", "marks": 0, "displayColumns": 0, "showCorrectAnswer": true, "type": "1_n_2", "minMarks": 0}], "statement": "
> m1 = movies[movies$Budget > 10000,]
> m2 = movies$Budget > 10000
", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {}, "metadata": {"notes": "", "description": "", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Question 16 vector mean and range", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Amy Chadwick", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/505/"}], "functions": {}, "ungrouped_variables": [], "tags": [], "preamble": {"css": "", "js": ""}, "advice": "

The function c combines the numbers in its argument into a vector, which in this case is assigned to $x$

\n

a)

\n

The function mean returns, as expected, the mean of the values in its argument.

\n

b)

\n

The function range returns a vector containing the minimum and maximum of its argument, in this case the minimum and maximum of $x$, so $1$ and $6$. In fact we could have answered this without any further information; this was the only possible answer, as we expected a vector with 2 elements.

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

What is the value of $y$?

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

$\\frac{7}{4}$

", "

$\\frac{7}{2}$

", "

$\\frac{6}{4}$

", "

$\\frac{5}{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": [0, 0, "1", 0], "shuffleChoices": false, "variableReplacements": [], "choices": ["

1 2 3 4 5 6

", "

5

", "

1 6

", "

6

"], "variableReplacementStrategy": "originalfirst", "maxMarks": "1", "distractors": ["", "", "", ""], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "1_n_2", "displayType": "radiogroup", "minMarks": 0}], "statement": "
> x = c(1,2,3,4,5,6)
> y = mean(x)
> z = range(x)
", "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": []}]}, {"name": "Amy's copy of Question 16 vector mean and range", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Amy Chadwick", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/505/"}], "functions": {}, "ungrouped_variables": [], "tags": [], "preamble": {"css": "", "js": ""}, "advice": "

x=1:10 creates a vector $x$ with 10 elements from 1 to 10.

\n

a)

\n

The function mean returns, as expected, the mean of the values in its argument, in this case the mean of the elements in the vector $x$.

\n

b)

\n

The length function returns the length of its argument, in this case the number of elements in $x$.

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

What is the value of $y$?

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

$\\frac{11}{2}$

", "

$\\frac{11}{4}$

", "

$\\frac{1}{2}$

", "

$\\frac{10}{2}$

"], "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": ["

1 2 3 4 5 6 7 8 9 10

", "

10

", "

1 10

", "

2

"], "variableReplacementStrategy": "originalfirst", "maxMarks": "1", "distractors": ["", "", "", ""], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "1_n_2", "displayType": "radiogroup", "minMarks": 0}], "statement": "
> x = 1:10
> y = mean(x)
> z = length(x)
", "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": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}, {"name": "Amy Chadwick", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/505/"}], "extensions": [], "custom_part_types": [], "resources": []}