Q. Two vectors M and N are defined as M <- c(3, 2, 4) and N <- c(1, 2). What will be the output of vector Z that is defined as Z <- M*N.

  • (A) Z <- (3, 2, 4)
  • (B) Z <- (3, 6, 4)
  • (C) Z <- (3, 4, 5)
  • (D) Z <- (3, 4, 4)
πŸ’¬ Discuss
βœ… Correct Answer: (D) Z <- (3, 4, 4)

Q. A programmer builds a . . . . . . . . to avoid repeating the same task or reduce complexity.

  • (A) Function
  • (B) Package
  • (C) Code
  • (D) Console
πŸ’¬ Discuss
βœ… Correct Answer: (A) Function

Q. Point out the correct statement?

  • (A) R has a number of ways to indicate to you that something's not right
  • (B) Executing any function in R may result in the condition
  • (C) "condition" is a generic concept for indicating that something unexpected has occurred
  • (D) All of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the mentioned

Q. Which of the following is valid body of split function?

  • (A) function (x, f)
  • (B) function (x, drop = FALSE, ...)
  • (C) function (x, f, drop = FALSE, ...)
  • (D) function (drop = FALSE, ...)
πŸ’¬ Discuss
βœ… Correct Answer: (C) function (x, f, drop = FALSE, ...)

Q. Which of the following is apply function in R?

  • (A) apply()
  • (B) tapply()
  • (C) fapply()
  • (D) rapply()
πŸ’¬ Discuss
βœ… Correct Answer: (B) tapply()

Q. . . . . . . . . returns TRUE then X can be termed as a matrix data object.

  • (A) is."matrix(X")
  • (B) is.matrix(X)
  • (C) is.notamatrix(X )
  • (D) is.matrix("X")
πŸ’¬ Discuss
βœ… Correct Answer: (B) is.matrix(X)

Q. . . . . . . . . package provides basic functionalities in R environment like arithmetic calculations, input/output.

  • (A) R base
  • (B) R boost
  • (C) R serve
  • (D) R comm
πŸ’¬ Discuss
βœ… Correct Answer: (A) R base

Q. What will be the output of the following R code?
> x <- 3
> switch(x, 2+2, mean(1:10), rnorm(5))

  • (A) 2.2903605 2.3271663 -0.7060073 1.3622045 -0.2892720
  • (B) 5.5
  • (C) NULL
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (A) 2.2903605 2.3271663 -0.7060073 1.3622045 -0.2892720

Q. What will be the output of the following R code?
> x <- 1:4
> lapply(x, runif)

  • (A) [[1]] [1] 0.02778712 [[2]] [1] 0.5273108 0.8803191 [[3]] [1] 0.37306337 0.04795913 0.13862825 [[4]] [1] 0.3214921 0.1548316 0.1322282 0.2213059
  • (B) [[1]] [1] 1.02778712 [[2]] [1] 2.5273108 0.8803191 [[3]] [1] 3.37306337 0.04795913 0.13862825 [[4]] [1] 0.3214921 0.1548316 0.1322282 0.2213059
  • (C) [[1]] [1] 1.02778712 [[2]] [1] 0.5273108 0.8803191 [[3]] [1] 0.37306337 0.04795913 0.13862825 [[4]] [1] 3.3214921 2.1548316 1.1322282 0.2213059
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (A) [[1]] [1] 0.02778712 [[2]] [1] 0.5273108 0.8803191 [[3]] [1] 0.37306337 0.04795913 0.13862825 [[4]] [1] 0.3214921 0.1548316 0.1322282 0.2213059

Q. What will be the output of the following R code?
> x <- c("a", "b", "c", "d")
> for(i in 1:4) {
+ ## Print out each element of 'x'
+ print(x[i])
+ }

  • (A) [1] "a" [1] "b" [1] "c" [1] "d"
  • (B) [1] "c" [1] "b" [1] "a" [1] "d"
  • (C) [1] "d" [1] "c" [1] "b" [1] "a"
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (A) [1] "a" [1] "b" [1] "c" [1] "d"