Q. What does RStudio provide for R programming?

  • (A) A programming language
  • (B) An integrated development environment
  • (C) A statistical model
  • (D) A data storage format
πŸ’¬ Discuss
βœ… Correct Answer: (B) An integrated development environment

Q. In R, how is a matrix created using the matrix() function?

  • (A) matrix(1:9, nrow = 3, ncol = 3)
  • (B) create.matrix(1:9, rows = 3, columns = 3)
  • (C) [1, 2, 3; 4, 5, 6; 7, 8, 9]
  • (D) mat(1:9, 3, 3)
πŸ’¬ Discuss
βœ… Correct Answer: (A) matrix(1:9, nrow = 3, ncol = 3)

Q. What is the purpose of the function Sys.Date() in R?

  • (A) Display current date and time
  • (B) Extract system information
  • (C) Retrieve the current date
  • (D) Convert date to character
πŸ’¬ Discuss
βœ… Correct Answer: (C) Retrieve the current date

Q. Which of the following is a valid R data type?

  • (A) String
  • (B) Boolean
  • (C) Complex
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the above

Q. How is a data frame created in R?

  • (A) df <- c(1, 2, 3)
  • (B) data.frame(x = 1:3, y = c('A', 'B', 'C'))
  • (C) createDataFrame(1, 2, 3)
  • (D) matrix(1:3, nrow = 1, ncol = 3)
πŸ’¬ Discuss
βœ… Correct Answer: (B) data.frame(x = 1:3, y = c('A', 'B', 'C'))

Q. Which of the following is invalid assignment?

  • (A) > c(10.4, 5.6, 3.1, 6.4, 21.7) -> x
  • (B) > assign("x", c(10.4, 5.6, 3.1, 6.4, 21.7))
  • (C) > x <- c(10.4, 5.6, 3.1, 6.4, 21.7)
  • (D) None of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (D) None of the mentioned

Q. Point out the wrong statement?

  • (A) is.nan() is used to test objects if they are NA
  • (B) is.nan() is used to test for NaN
  • (C) NA values have a class
  • (D) NA values have a class, so there are integer NA, character NA, etc
πŸ’¬ Discuss
βœ… Correct Answer: (A) is.nan() is used to test objects if they are NA

Q. If you explicitly want an integer, you need to specify the . . . . . . . . suffix.

  • (A) D
  • (B) R
  • (C) L
  • (D) K
πŸ’¬ Discuss
βœ… Correct Answer: (C) L

Q. The first component can be accessed using . . . . . . . . operator.

  • (A) Intraction
  • (B) Extraction
  • (C) AND
  • (D) OR
πŸ’¬ Discuss
βœ… Correct Answer: (B) Extraction

Q. What will be the output of the following R code?
> x <- vector("numeric", length = 10)
> x

  • (A) 10
  • (B) 0 0 0 0 0 0 0 0 0 0
  • (C) 01
  • (D) 00120
πŸ’¬ Discuss
βœ… Correct Answer: (B) 0 0 0 0 0 0 0 0 0 0