R Programming Quizzes
Lists
Question 1
What is the key characteristic of an R list that distinguishes it from an atomic vector (like a numeric or character vector)?
Question 2
The function used to create a list in R is _____().
Your answer here.Question 3
Given my_list <- list(a = 1:3, b = "hello"), what is the data type of the object returned by the expression my_list[1]?
Question 4
Given the list x <- list(name = "Alice", age = 30, scores = c(95, 88)), select all expressions that correctly extract the single value 30.
Question 5
Which command correctly assigns the names 'a', 'b', and 'c' to the elements of an existing list named L?
Question 6
What is the result of using the c() function to combine two lists, list1 <- list(a=1) and list2 <- list(b="two")?
Question 7
The R object used to get an overview of the contents and data types within a list is the _____() function.
Your answer here.Question 8
Which of the following R objects can be included as elements within a single R list?
End of Quiz
Your final score is: 0 / 0
List of Questions
Question 1: What is the key characteristic of an R list that distinguishes it from an atomic vector (like a numeric or character vector)?
Answers: It can contain elements of different data types..
Question 2: Given `my_list <- list(a = 1:3, b = "hello")`, what is the data type of the object returned by the expression `my_list[1]`?
Answers: list.
Question 3: Given the list `x <- list(name = "Alice", age = 30, scores = c(95, 88))`, select all expressions that correctly extract the single value `30`.
Answers: x$age, x[[2]], x[["age"]].
Question 4: Which command correctly assigns the names 'a', 'b', and 'c' to the elements of an existing list named `L`?
Answers: names(L) <- c("a", "b", "c").
Question 5: What is the result of using the `c()` function to combine two lists, `list1 <- list(a=1)` and `list2 <- list(b="two")`?
Answers: It creates a new, longer list containing the elements of both original lists..
Question 6: Which of the following R objects can be included as elements within a single R list?
Answers: A numeric vector, A data frame, A function, Another list, A logical vector.