The Final Exam 2/2 will be held on March 14, 2025, from 8:00 to 11:00 AM at the ICDI building. Total Score: 15% of 100% - 5%: Multiple-choice questions. - 10%: Answering questions, editing, or showing the code based on the given results. You are allowed to use your computer/iPad/Tablet to run the R program. However, you are not allowed to use the internet to search for solutions via search engines (e.g., Google) or generative AI (e.g., ChatGPT). You are not allowed to discuss anything in the testing room. You are allowed to bring and write notes on one A4 page (both sides).
Multiple Choices: Vectors
Questions
What function is commonly used to create a sequence of numbers in a vector?
Which function combines multiple values into a single vector in R?
What will be the output of the following code: c(1, 2, 3) + c(4, 5, 6)?
Which function is used to determine the type of elements in a vector?
What will be the output of length(c(10, 20, 30, 40))?
If x <- c(5, 10, 15, 20, 25), what is the output of x[2]?
What is the result of sum(c(2, 4, 6, 8, 10))?
Which of the following functions will check if an object is a vector?
What will be the result of c(1, 2, 3) * 2?
If y <- c("apple", "banana", "cherry"), what is the result of y[2:3]?
What is the output of the following code: rep(1, times = 5)?
What does the function mean() do when applied to a numeric vector?
What will be the output of c(1, 2, 3) > 2?
Which function would you use to remove duplicate elements from a vector in R?
If z <- c(1, 2, NA, 4), what will be the result of mean(z, na.rm = TRUE)?
Which operator will concatenate two vectors in R?
What will be the output of c(TRUE, FALSE, TRUE) & c(TRUE, TRUE, FALSE)?
What does sum(c(TRUE, FALSE, TRUE, FALSE, TRUE)) return?
Which function would you use to reverse the order of elements in a vector?
If x <- c(3, 6, 9, 12, 15), what does x[x > 9] return?
What is the result of c(1, "2", 3) in R?
Which function would you use to repeat each element of a vector a specified number of times?
What will x[1:3] <- c(10, 20, 30) do to x <- c(1, 2, 3, 4, 5)?
What will the expression 1:5 * 2 return?
What is the output of which(c(FALSE, TRUE, FALSE, TRUE))?
What will be the output of any(c(FALSE, FALSE, TRUE))?
What will x <- c(5, 10, 15); y <- x * x > 25 set y to?
What is the result of c(1, 2, NA, 4) == NA in R?
Which function would you use to sort a vector in ascending order?
If z <- c("a", "b", "c", "d"), what does z[c(FALSE, TRUE, TRUE, FALSE)] return?