Q. In R, what is the primary data structure to store a sequence of elements of the same type?

  • (A) List
  • (B) Matrix
  • (C) Data Frame
  • (D) Vector
πŸ’¬ Discuss
βœ… Correct Answer: (D) Vector

Q. What does the factor data type represent in R?

  • (A) Text data
  • (B) Categorical data
  • (C) Numeric data
  • (D) Date data
πŸ’¬ Discuss
βœ… Correct Answer: (B) Categorical data

Q. In R, how is a comment denoted?

  • (A) // Comment
  • (B) /* Comment */
  • (C) # Comment
  • (D) -- Comment
πŸ’¬ Discuss
βœ… Correct Answer: (C) # Comment

Q. Which of the following is a valid way to create a numeric vector in R?

  • (A) c(1, 2, 3)
  • (B) vector(1, 2, 3)
  • (C) seq(1, 3)
  • (D) num_vec(1, 2, 3)
πŸ’¬ Discuss
βœ… Correct Answer: (A) c(1, 2, 3)

Q. How is the length of a vector determined in R?

  • (A) length(vector)
  • (B) size(vector)
  • (C) count(vector)
  • (D) dim(vector)
πŸ’¬ Discuss
βœ… Correct Answer: (A) length(vector)

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

  • (A) Concatenate strings
  • (B) Split a string
  • (C) Format a string
  • (D) Search for a substring
πŸ’¬ Discuss
βœ… Correct Answer: (A) Concatenate strings

Q. . . . . . . . . generate summary statistics of different variables in the data frame, possibly within strata.

  • (A) rename
  • (B) summarize
  • (C) set
  • (D) subset
πŸ’¬ Discuss
βœ… Correct Answer: (B) summarize

Q. What will be the output of the following R code?
> x <- list(aardvark = 1:5)
> x$a

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

Q. Which of the following function gives the day of the week?

  • (A) weekdays
  • (B) months
  • (C) quarters
  • (D) semesters
πŸ’¬ Discuss
βœ… Correct Answer: (A) weekdays

Q. Point out the wrong statement?

  • (A) $ operator semantics are similar to that of [[
  • (B) The [ operator always returns an object of the same class as the original
  • (C) The $ operator is used to extract elements of a list or a data frame
  • (D) There are three operators that can be used to extract subsets of R objects
πŸ’¬ Discuss
βœ… Correct Answer: (C) The $ operator is used to extract elements of a list or a data frame