Q. Warnings are generated by the . . . . . . . . function.

  • (A) warning()
  • (B) error()
  • (C) run()
  • (D) message()
πŸ’¬ Discuss
βœ… Correct Answer: (A) warning()

Q. Point out the correct statement?

  • (A) The traceback() function must be called immediately after an error occurs
  • (B) The debugger calls the browser at the very low level of the function body
  • (C) Every time you call the mod() function it will launch the interactive debugger
  • (D) R provides only two tools to help you with debugging your code
πŸ’¬ Discuss
βœ… Correct Answer: (A) The traceback() function must be called immediately after an error occurs

Q. Point out the correct statement?

  • (A) Vectorizing the function can be accomplished easily with the Vectorize() function
  • (B) There are different levels of indication that can be used, ranging from mere notification to fatal error
  • (C) Vectorizing the function can be accomplished easily with the vector() function
  • (D) Warnings are generated by the run() function
πŸ’¬ Discuss
βœ… Correct Answer: (A) Vectorizing the function can be accomplished easily with the Vectorize() function

Q. What will be the output of the following R code snippet?
> paste("a", "b", sep = ":")

  • (A) "a+b"
  • (B) "a=b"
  • (C) "a:b"
  • (D) a*b
πŸ’¬ Discuss
βœ… Correct Answer: (C) "a:b"

Q. What will be the output of the following R code?
> mean(x)
Error in mean(x) : object 'x' not found
> traceback()

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

Q. Which of the following R code will print "Hello, world!"?

  • (A) > f <- function() { + cat("Hello, world!\n") + } > f()
  • (B) > f <- function() { + cat("Hello, World!\n") + } < f()
  • (C) > f <- function() { + cat("Hello world!\n") + } >>= f()
  • (D) > f <- function() { - cat("Hello world!\n") + } <= f()
πŸ’¬ Discuss
βœ… Correct Answer: (A) > f <- function() { + cat("Hello, world!\n") + } > f()

Q. What will be the output of the following R code snippet?
> f <- function(a, b) {
+ print(a)
+ print(b)
+ }
> f(45)

  • (A) 32
  • (B) 42
  • (C) 52
  • (D) 45
πŸ’¬ Discuss
βœ… Correct Answer: (D) 45

Q. The syntax of the repeat loop is . . . . . . . .

  • (A) rep statement
  • (B) repeat statement
  • (C) repeat else
  • (D) repeat while
πŸ’¬ Discuss
βœ… Correct Answer: (B) repeat statement

Q. In the base graphics system, which function is used to add elements to a plot?

  • (A) Boxplot()
  • (B) Text()
  • (C) Boxplot() or Text()
  • (D) Treat()
πŸ’¬ Discuss
βœ… Correct Answer: (C) Boxplot() or Text()

Q. Which of the following R code generate a uniform random number?

  • (A) x <- runif(1, 0, 10) if(x > 3) { y <- 10 } else { y <- 0 }
  • (B) x <- run(1, 0, 10) if(x > 3) { y <- 10 } else { y <- 0 }
  • (C) x <- random(1, 0, 10) if(x > 3) { y <- 10 } else { y <- 0 }
  • (D) x <- random(1, 0, 10) if(x > 1) { y <- 0 } else { x <- 0 }
πŸ’¬ Discuss
βœ… Correct Answer: (A) x <- runif(1, 0, 10) if(x > 3) { y <- 10 } else { y <- 0 }