R Programming Quiz Questions and Answers

Which Package contains most fundamental functions to run R?

Answer :
  • base

What is the output of getOption(“defaultPackages”) in R studio?

Answer :
  • Shows default packages in R

Advanced users can write ___ code to manipulate R objects directly.

Answer :
  • C, C++

If the code is stored in the external file, which of the following function is used to call them to a working directory?

Answer :
  • source()

The four most frequently used types of data objects in R are vectors, matrices, data frames and ________.

Answer :
  • Lists

What will be the output of the following R code? X <- 1 print(x)

Answer :
  • 1

What is the meaning of the following R function? print( sqrt(2) )

Answer :
  • 1.414214

What will be the output of the following R function? d <- diag(5, nrow=2, ncol=2) d

Answer :
  • 5 0 0 5

What will be the output of the following R code? > x <- 1:3 > y <- 10:12 > rbind(x, y)

Answer :
  • [,1] [,2] [,3] x 1 2 3 y 10 11 12

Which of the following is valid assignment?

Answer :
  • x <- factor(c("yes", "yes", "no", "yes", "no"))