Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 12 MCQs R Tool

ECAP792 60 questions. Pick an option to check it.

Read the notes Subjective questions

0 of 60 answered 0 right 0 wrong , 60 left

  1. Question 1 of 60 Introduction to R Easy

    What is R primarily used for?

  2. Question 2 of 60 Introduction to R Easy

    Which symbol is commonly used to assign a value to a variable in R?

  3. Question 3 of 60 RStudio Easy

    What is RStudio?

  4. Question 4 of 60 RStudio Easy

    Which RStudio pane normally displays commands and their immediate results?

  5. Question 5 of 60 Important R data structures Easy

    Which R data structure stores data in rows and columns while allowing columns to have different data types?

  6. Question 6 of 60 Important R data structures Easy

    Which R data structure is one-dimensional and usually contains elements of the same basic type?

  7. Question 7 of 60 Vectors Easy

    Which R function combines values to create a vector?

  8. Question 8 of 60 Vectors Easy

    What is the result of length(c(5, 10, 15, 20))?

  9. Question 9 of 60 Vectors Easy

    Which expression selects the second element of a vector named scores?

  10. Question 10 of 60 Character strings Easy

    Which value is a valid character string in R?

  11. Question 11 of 60 Character strings Easy

    Which function joins character strings together in R?

  12. Question 12 of 60 Matrices Easy

    What is a matrix in R?

  13. Question 13 of 60 Matrices Easy

    Which function is used to create a matrix in R?

  14. Question 14 of 60 Matrices Easy

    Which expression selects the element in row 2 and column 3 of matrix m?

  15. Question 15 of 60 Lists Easy

    What is a key feature of an R list?

  16. Question 16 of 60 Lists Easy

    Which function creates a list in R?

  17. Question 17 of 60 Dataframe Easy

    Which function creates a dataframe in R?

  18. Question 18 of 60 Dataframe Easy

    How can the column named age be accessed from a dataframe named students?

  19. Question 19 of 60 R programming structure Easy

    Which symbol begins a comment in R?

  20. Question 20 of 60 R programming structure Easy

    Which keyword is used to define a function in R?

  21. Question 21 of 60 Introduction to R Medium

    What is returned by rep(seq(2, 6, by = 2), times = c(1, 2, 1))?

  22. Question 22 of 60 Introduction to R Medium

    Given x <- c(4, 7, 9, 12), what does x[-c(1, 3)] return?

  23. Question 23 of 60 RStudio Medium

    An RStudio project has its working directory set to the project root. What does read.csv("data/sales.csv") do?

  24. Question 24 of 60 RStudio Medium

    While editing an R script in RStudio, which action runs only the selected code in the active R session?

  25. Question 25 of 60 Important R data structures Medium

    Consider f <- factor(c("high", "low", "high"), levels = c("low", "high")). What does as.integer(f) return?

  26. Question 26 of 60 Important R data structures Medium

    For f <- factor(c("A", "B", "A")), which pair correctly describes typeof(f) and class(f)?

  27. Question 27 of 60 Vectors Medium

    What is the result of c(1, 2) + c(10, 20, 30, 40)?

  28. Question 28 of 60 Vectors Medium

    Given x <- c(10, 20, 30, 40, 50), what does x[c(TRUE, FALSE)] return?

  29. Question 29 of 60 Vectors Medium

    What is the storage type and value of c(TRUE, 2L, 3.5)?

  30. Question 30 of 60 Character strings Medium

    What does paste(c("R", "Data", "Tool"), collapse = "-") return?

  31. Question 31 of 60 Character strings Medium

    What is returned by grepl("^[A-Z][0-9]+$", c("A12", "ab3", "B7"))?

  32. Question 32 of 60 Matrices Medium

    Given m <- matrix(1:8, nrow = 2), what does m[, 3] return?

  33. Question 33 of 60 Matrices Medium

    Consider m <- matrix(1:6, nrow = 2, byrow = TRUE). What does apply(m, 2, sum) return?

  34. Question 34 of 60 Lists Medium

    Given z <- list(a = 10, b = c(2, 4)), which expression returns the numeric value 4?

  35. Question 35 of 60 Lists Medium

    What is the structure of lapply(c(1, 2, 3), function(v) v + 1)?

  36. Question 36 of 60 Dataframe Medium

    Given df <- data.frame(name = c("Ana", "Bo", "Cy"), group = c("A", "B", "A"), score = c(80, 90, 65)), what does df[df$group == "A" & df$score >= 70, "name"] return?

  37. Question 37 of 60 Dataframe Medium

    Consider df <- data.frame(score = c(8, NA, 6)). After df$score[is.na(df$score)] <- mean(df$score, na.rm = TRUE), what is df$score?

  38. Question 38 of 60 R programming structure Medium

    What are the values of result and global x after running x <- 10; f <- function(y) { x <- 2; x + y }; result <- f(3)?

  39. Question 39 of 60 R programming structure Medium

    Given grade <- function(x) ifelse(x >= 50, "pass", "fail"), what does grade(c(40, 50, 70)) return?

  40. Question 40 of 60 R programming structure Medium

    What is the final value of total after total <- 0; for (i in 1:5) { if (i %% 2 == 0) next; total <- total + i }?

  41. Question 41 of 60 Introduction to R Hard

    What is the value of c(identical(1, 1L), typeof(1), typeof(1L)) in R?

  42. Question 42 of 60 Introduction to R Hard

    Which statement correctly describes evaluating stats::filter(x, rep(1, 3)) when the stats package is not attached?

  43. Question 43 of 60 RStudio Hard

    Which statement about an RStudio Project is accurate?

  44. Question 44 of 60 Important R data structures Hard

    Given f <- factor(c("b", "a", "b"), levels = c("b", "a")), what does c(sum(as.integer(f)), paste(as.character(f), collapse = "")) return?

  45. Question 45 of 60 Important R data structures Hard

    What value is returned by the final expression?

    e1 <- new.env()

    e1$x <- 1

    e2 <- e1

    e2$x <- 8

    e1$x

  46. Question 46 of 60 Vectors Hard

    For x <- c(NA_real_, NaN, Inf, -Inf, 0), what is c(sum(is.na(x)), sum(is.nan(x)), sum(is.finite(x)))?

  47. Question 47 of 60 Vectors Hard

    Given x <- c(a = 10, b = 20, a = 30), what does x[c("a", "a")] return?

  48. Question 48 of 60 Vectors Hard

    After x <- 1:3; x[5] <- 9, which description of x is correct?

  49. Question 49 of 60 Character strings Hard

    What does sub(".", "-", "a.b.c", fixed = TRUE) return?

  50. Question 50 of 60 Character strings Hard

    What is returned by strsplit("a,b,", ",", fixed = TRUE)[[1]]?

  51. Question 51 of 60 Matrices Hard

    Given m <- matrix(1:6, nrow = 2), what is m[cbind(c(2, 1, 2), c(1, 3, 2))]?

  52. Question 52 of 60 Matrices Hard

    For m <- matrix(1:6, nrow = 2), which pair describes m[1, , drop = FALSE]?

  53. Question 53 of 60 Lists Hard

    Given z <- list(a = list(b = 1:3), b = 4), what does z[[c("a", "b")]] return?

  54. Question 54 of 60 Lists Hard

    With default R options and x <- list(alpha = 7, beta = 9), which expression evaluates to TRUE?

  55. Question 55 of 60 Dataframe Hard

    Given d <- data.frame(x = 1:3, y = 4:6), what is the result of c(is.data.frame(d["x"]), is.data.frame(d[, "x"]), is.data.frame(d[, "x", drop = FALSE]))?

  56. Question 56 of 60 Dataframe Hard

    Under the default check.names = TRUE, what is names(data.frame(x = 1:2, x = 3:4))?

  57. Question 57 of 60 R programming structure Hard

    What does the following code return?

    x <- 10

    f <- function(y = x) {

    x <- 20

    y

    }

    f()

  58. Question 58 of 60 R programming structure Hard

    What is returned by the final expression?

    make_counter <- function() {

    x <- 0

    function() { x <<- x + 1; x }

    }

    a <- make_counter()

    b <- make_counter()

    c(a(), a(), b())

  59. Question 59 of 60 R programming structure Hard

    What happens when this code is evaluated?

    f <- function(x) 1

    f(stop("boom"))

  60. Question 60 of 60 R programming structure Hard

    What is returned by this code?

    make_funs <- function() {

    fs <- vector("list", 3)

    for (i in 1:3) fs[[i]] <- function() i

    fs

    }

    sapply(make_funs(), function(f) f())

That's unit 12

Answer a few questions and your score shows up here.