Q. Which function is difficult to implement?

  • (A) Lapply
  • (B) Japply
  • (C) Vapply
  • (D) Zapply
πŸ’¬ Discuss
βœ… Correct Answer: (C) Vapply

Q. . . . . . . . . allows you to modify the error behavior so that you can browse the function call stack

  • (A) debug()
  • (B) trace()
  • (C) recover()
  • (D) traceback()
πŸ’¬ Discuss
βœ… Correct Answer: (C) recover()

Q. Which of the following is primary tool for debugging?

  • (A) debug()
  • (B) trace()
  • (C) browser()
  • (D) traceback()
πŸ’¬ Discuss
βœ… Correct Answer: (A) debug()

Q. Point out the correct statement?

  • (A) An environment is a collection of (symbol, value) pairs, i.e. x is a symbol and 3.14 might be its value
  • (B) If the value of a symbol is not found in the environment in which a function was defined, then the search is continued in the child environment
  • (C) After the top-level environment, the search continues down the search list until we hit the parent environment
  • (D) Dynamic scoping turns out to be particularly useful for simplifying statistical computations
πŸ’¬ Discuss
βœ… Correct Answer: (A) An environment is a collection of (symbol, value) pairs, i.e. x is a symbol and 3.14 might be its value

Q. How will you check if an element is present in a vector?

  • (A) Match()
  • (B) Dismatch()
  • (C) Mismatch()
  • (D) Search()
πŸ’¬ Discuss
βœ… Correct Answer: (A) Match()

Q. Which function helps you perform sorting in R language?

  • (A) Order
  • (B) Inorder
  • (C) Simple
  • (D) Library
πŸ’¬ Discuss
βœ… Correct Answer: (A) Order

Q. What will be the output of the following R code?
> f <- function(num) {
+ for(i in seq_len(num)) {
+ cat("Hello, world!\n")
+ }
+ }
> f(3)

  • (A) Hello, world! Hello, world!
  • (B) Hello, world! Hello, world! Hello, world!
  • (C) Hello, world!
  • (D) Hello, world! Hello, world! Hello, world! Hello, world!
πŸ’¬ Discuss
βœ… Correct Answer: (B) Hello, world! Hello, world! Hello, world!

Q. . . . . . . . . is used to apply a function over subsets of a vector.

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

Q. Which of the variable in the following R code is variable?
> f <- function(x, y) {
+ x^2 + y / z
+ }

  • (A) x
  • (B) y
  • (C) z
  • (D) yy
πŸ’¬ Discuss
βœ… Correct Answer: (C) z

Q. What will be the output of the following R code?
function(p) {
params[!fixed] <- p
mu <- params[1]
sigma <- params[2]
## Calculate the Normal density
a <- -0.5*length(data)*log(2*pi*sigma^2)
b <- -0.5*sum((data-mu)^2) / (sigma^2)
-(a + b)
}
> ls(environment(nLL))

  • (A) "data" "fixed" "param"
  • (B) "data" "variable" "params"
  • (C) "data" "fixed" "params"
  • (D) "data" "param"
πŸ’¬ Discuss
βœ… Correct Answer: (C) "data" "fixed" "params"