Q. . . . . . . . . initiates an infinite loop right from the start.

  • (A) never
  • (B) repeat
  • (C) break
  • (D) set
πŸ’¬ Discuss
βœ… Correct Answer: (B) repeat

Q. What will be the output of runif()?

  • (A) Random number
  • (B) Numbers
  • (C) Character
  • (D) Path generation
πŸ’¬ Discuss
βœ… Correct Answer: (A) Random number

Q. What will be the output of the following R code snippet?
> g <- function(x) {
+ a <- 3
+ x+a+y
+ ## 'y' is a free variable
+ }
> g(2)

  • (A) 9
  • (B) 42
  • (C) 8
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (D) Error

Q. . . . . . . . . will produce a sequential vector c( (1,2,3,4,5,6,7,8,9)).

  • (A) Seq(9)
  • (B) Seq(10)
  • (C) Seq(15)
  • (D) Seq(12)
πŸ’¬ Discuss
βœ… Correct Answer: (A) Seq(9)

Q. What are the different types of sorting algorithms available in R language?

  • (A) Bubble
  • (B) Selection
  • (C) Merge
  • (D) All sorts
πŸ’¬ Discuss
βœ… Correct Answer: (D) All sorts

Q. Which function calculates the count of each category of a categorical variable?

  • (A) Table
  • (B) Intact
  • (C) Tables
  • (D) Retabs
πŸ’¬ Discuss
βœ… Correct Answer: (A) Table

Q. . . . . . . . . applies a function over the margins of an array.

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

Q. The syntax of the for loop is?

  • (A) for ( $name in vector ) statement1
  • (B) for loop( name in vector ) statement1
  • (C) for ( name in vector ) statement1
  • (D) forif loop( name in vector ) statement1
πŸ’¬ Discuss
βœ… Correct Answer: (C) for ( name in vector ) statement1

Q. What will be the output of the following R code?
> printmessage2 <- function(x) {
+ if(is.na(x))
+ print("x is a missing value!")
+ else if(x > 0)
+ print("x is greater than zero")
+ else
+ print("x is less than or equal to zero")
+ invisible(x)
+ }
> printmessage2(NA)

  • (A) "x is a missing value!"
  • (B) "x is greater than zero"
  • (C) "x is less than or equal to zero"
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (A) "x is a missing value!"

Q. . . . . . . . . require you to pass a function whose argument is a vector of parameters.

  • (A) optimize()
  • (B) optimise()
  • (C) opt()
  • (D) opm()
πŸ’¬ Discuss
βœ… Correct Answer: (C) opt()