Q. What does the R function seq(1, 10, by = 2) produce?

  • (A) 1, 3, 5, 7, 9
  • (B) 1, 2, 3, 4, 5
  • (C) 1, 4, 7, 10
  • (D) 2, 4, 6, 8, 10
πŸ’¬ Discuss
βœ… Correct Answer: (A) 1, 3, 5, 7, 9

Q. How do you check the class of an object in R?

  • (A) class(object)
  • (B) type(object)
  • (C) typeof(object)
  • (D) obj_class(object)
πŸ’¬ Discuss
βœ… Correct Answer: (A) class(object)

Q. What is the purpose of the R function rnorm(100, mean = 0, sd = 1)?

  • (A) Generate 100 random numbers from a normal distribution with mean 0 and SD 1
  • (B) Generate a sequence from 1 to 100 with mean 0 and SD 1
  • (C) Create a normal distribution plot
  • (D) Compute the cumulative distribution function
πŸ’¬ Discuss
βœ… Correct Answer: (A) Generate 100 random numbers from a normal distribution with mean 0 and SD 1

Q. Which operator is used for element-wise multiplication in R?

  • (A) *
  • (B) %*%
  • (C) %%%
  • (D) %^%
πŸ’¬ Discuss
βœ… Correct Answer: (A) *

Q. In R, what is the purpose of the rep() function?

  • (A) Repeat elements of a vector or a sequence
  • (B) Replace elements in a vector
  • (C) Resize a data frame
  • (D) Represent a sequence
πŸ’¬ Discuss
βœ… Correct Answer: (A) Repeat elements of a vector or a sequence

Q. What is the primary purpose of R programming language?

  • (A) Web Development
  • (B) Data Analysis
  • (C) Game Development
  • (D) Mobile App Development
πŸ’¬ Discuss
βœ… Correct Answer: (B) Data Analysis

Q. In R, what does the function length() do?

  • (A) Returns the sum of elements
  • (B) Returns the number of elements
  • (C) Sorts the elements
  • (D) Computes the mean
πŸ’¬ Discuss
βœ… Correct Answer: (B) Returns the number of elements

Q. How is a comment denoted in R?

  • (A) // Comment
  • (B) /* Comment */
  • (C) # Comment
  • (D) -- Comment
πŸ’¬ Discuss
βœ… Correct Answer: (C) # Comment

Q. What does the function install.packages() do in R?

  • (A) Load a package
  • (B) Uninstall a package
  • (C) Install a new package
  • (D) Update all packages
πŸ’¬ Discuss
βœ… Correct Answer: (C) Install a new package

Q. Which of the following is a correct variable name in R?

  • (A) 123_variable
  • (B) variable_name_123
  • (C) my-variable
  • (D) 1st_variable
πŸ’¬ Discuss
βœ… Correct Answer: (B) variable_name_123