Site icon T4Tutorials.com

R Programming for Data Analysis MCQs

  1. Which of the following functions is used to read a CSV file into R?

Answer: (A) read.csv()

2. What does the apply() function do in R?

Answer: (A) Applies a function to a data frame or matrix margin (rows or columns)

3. Which of the following functions can be used to create a linear model in R?

Answer: (A) lm()

4. What is the purpose of the str() function in R?

Answer: (A) Displays the structure of an R object

5. How do you handle missing values in a data frame in R?

Answer: (D) All of the above

6. In R, what does the ggplot2 package primarily provide?

Answer: (C) A framework for creating data visualizations

7. What is the primary purpose of the dplyr package in R?

Answer: (B) To clean, filter, and summarize data efficiently

8. Which function would you use to generate a random sample of size n from a normal distribution in R?

Answer: (A) rnorm(n)

9. What is the default method for computing the mean of a numeric vector in R?

Answer: (A) mean()

9. In R, which function is used to concatenate two or more vectors or strings?

Answer: (B) c()

Exit mobile version