Q. What will be the output of the following R code?
> x <- matrix(1:6, 2, 3)
> x[1, ]

  • (A) 1 3 5
  • (B) 2 3 5
  • (C) 3 3 5
  • (D) file
πŸ’¬ Discuss
βœ… Correct Answer: (A) 1 3 5

Q. Which of the following extracts first four element from the following R vector?
> x <- c("a", "b", "c", "c", "d", "a")

  • (A) x[0:4]
  • (B) x[1:4]
  • (C) x[0:3]
  • (D) x[4:3]
πŸ’¬ Discuss
βœ… Correct Answer: (B) x[1:4]

Q. The . . . . . . . . function is used to generate summary statistics from the data frame within strata defined by a variable.

  • (A) groupby()
  • (B) group()
  • (C) group_by()
  • (D) arrange
πŸ’¬ Discuss
βœ… Correct Answer: (C) group_by()

Q. Main way to read the data back in (parsing it) using the function.

  • (A) dput()
  • (B) write()
  • (C) read()
  • (D) dget()
πŸ’¬ Discuss
βœ… Correct Answer: (D) dget()

Q. If we want to save individual R objects to a file, we use the . . . . . . . . function.

  • (A) save()
  • (B) save.image()
  • (C) serialize()
  • (D) deserialize()
πŸ’¬ Discuss
βœ… Correct Answer: (A) save()

Q. load() is used for . . . . . . . .

  • (A) reading
  • (B) loading
  • (C) working
  • (D) not exist
πŸ’¬ Discuss
βœ… Correct Answer: (A) reading

Q. What will be the output of the following R code?
> x <- 1:4
> y <- 6:9
> z <- x + y
> z

  • (A) 7 9 11 13
  • (B) 7 9 11 13 14
  • (C) 9 7 11 13
  • (D) NULL
πŸ’¬ Discuss
βœ… Correct Answer: (A) 7 9 11 13

Q. Which of the following extracts first element from the following R list?
> x <- list(foo = 1:4, bar = 0.6)

  • (A) x[[1]]
  • (B) x[1]
  • (C) x[[0]]
  • (D) x[0]
πŸ’¬ Discuss
βœ… Correct Answer: (A) x[[1]]

Q. How do you extract the first row of a data frame named my_data in R?

  • (A) my_data[1, ]
  • (B) my_data[first_row()]
  • (C) my_data[,"row" == 1]
  • (D) extract_row(my_data, 1)
πŸ’¬ Discuss
βœ… Correct Answer: (A) my_data[1, ]

Q. In R, what is the purpose of the table() function?

  • (A) Create a contingency table from factors
  • (B) Display a table of values
  • (C) Generate a summary of data using tables
  • (D) Count the number of rows and columns in a data frame
πŸ’¬ Discuss
βœ… Correct Answer: (A) Create a contingency table from factors