Chapter 2 Multiple choice questions

Quiz Content

not completed
. What is the appropriate way to request the 10th entry of the variable numberlist in R?

not completed
. The matrix K contains 8 row and 5 columns. How would you request the data from the 3rd column?

not completed
. Which of the following lines of code will create a loop that repeats 15 times?

not completed
. Which line of code correctly merges the two strings 'hap' and 'py' into a single string ('happy')?

not completed
. The median function calculates the median of a vector of numbers. Which of the following lines of code returns a median of 7?

not completed
. If the data object 'a' contains the values 2, 4 and 6, what will be returned by the following line of code: a^3

not completed
. To tell an if statement to execute some code when the value of a is greater than or equal to 10, which expression would you use?

not completed
. Which of the following expressions is FALSE?

not completed
. Which option is the correct R syntax for an if statement that prints the value of n when it is greater than 10?

not completed
. The following code defines a function. What does it do?
mysteryfunction <- function(input1, input2){
numerator <- (input1 – input2)
denominator <- (input1 + input2)
output <- numerator/denominator
return(output)}

Back to top