Q. Which of the following is valid syntax for if else statement in R?

  • (A) if(<condition>) { ## do something } else { ## do something else }
  • (B) if(<condition>) { ## do something } elseif { ## do something else }
  • (C) if(<condition>) { ## do something } else if { ## do something else }
  • (D) if(<condition>) { ##& do something } else { ##@ do something else }
πŸ’¬ Discuss
βœ… Correct Answer: (A) if(<condition>) { ## do something } else { ## do something else }

Q. What will be the class of the vector if you concatenate a number and NA?

  • (A) Number
  • (B) Character
  • (C) Integer
  • (D) No class
πŸ’¬ Discuss
βœ… Correct Answer: (A) Number

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

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

Q. . . . . . . . . function is preferred over sapply as vapply allows the programmer to specific the output type.

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

Q. The line of code in R language should begin with a . . . . . . . .

  • (A) Hash symbol
  • (B) Alphabet
  • (C) Number
  • (D) Character
πŸ’¬ Discuss
βœ… Correct Answer: (A) Hash symbol

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

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

Q. CRAN package ecosystem has more than . . . . . . . . packages.

  • (A) 5000
  • (B) 4000
  • (C) 6000
  • (D) 8000
πŸ’¬ Discuss
βœ… Correct Answer: (C) 6000

Q. . . . . . . . . function will measure the probability of the binary response variable in R language.

  • (A) Glm()
  • (B) Glmi()
  • (C) Gelmi()
  • (D) Jlm()
πŸ’¬ Discuss
βœ… Correct Answer: (A) Glm()

Q. Point out the correct statement?

  • (A) Writing functions is a core activity of an R programmer
  • (B) Functions are often used to encapsulate a sequence of expressions that need to be executed numerous times
  • (C) Functions are also often written when code must be shared with others or the public
  • (D) All of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the mentioned

Q. How missing values and impossible values are represented in R language?

  • (A) NA
  • (B) NAN
  • (C) NA & NAN
  • (D) Not Exist
πŸ’¬ Discuss
βœ… Correct Answer: (C) NA & NAN