0% found this document useful (0 votes)
21 views

Data Visualization MCQ

Uploaded by

smdshoyab07
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Data Visualization MCQ

Uploaded by

smdshoyab07
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

MCQs: Data Visualization - Advanced R Programming for Data Analytics

1. Which of the following packages is most commonly used for data visualization in R?

A) dplyr

B) ggplot2

C) caret

D) shiny

Answer: B) ggplot2

2. In ggplot2, which function is used to create a scatter plot?

A) geom_point()

B) geom_line()

C) geom_bar()

D) geom_histogram()

Answer: A) geom_point()

3. Which of the following arguments is used to change the title of a plot in ggplot2?

A) ggtitle()

B) main_title()

C) title()

D) plot_title()

Answer: A) ggtitle()

4. What does the function geom_histogram() in ggplot2 do?

A) Creates a scatter plot

B) Creates a histogram
C) Creates a line plot

D) Creates a bar chart

Answer: B) Creates a histogram

5. Which function in base R is used to create a bar plot?

A) barplot()

B) plot()

C) hist()

D) pie()

Answer: A) barplot()

6. How can you add labels to the x-axis in a ggplot plot?

A) xlabel()

B) xlab()

C) axis_title()

D) label_x()

Answer: B) xlab()

7. What is the default theme used in ggplot2 for plots?

A) theme_minimal()

B) theme_gray()

C) theme_classic()

D) theme_void()

Answer: B) theme_gray()

8. Which function in ggplot2 is used to create a box plot?


A) geom_boxplot()

B) geom_bar()

C) geom_line()

D) geom_point()

Answer: A) geom_boxplot()

9. How can you modify the color of the points in a scatter plot in ggplot2?

A) color()

B) col()

C) fill()

D) aes(color=)

Answer: D) aes(color=)

10. Which of the following can be used to create a pie chart in base R?

A) pie()

B) plot()

C) hist()

D) barplot()

Answer: A) pie()

11. In ggplot2, what is the purpose of aes()?

A) To map data to aesthetics

B) To set the plot title

C) To change the plot theme

D) To generate axis labels

Answer: A) To map data to aesthetics


12. What does the function geom_line() in ggplot2 do?

A) Creates a line plot

B) Creates a scatter plot

C) Creates a bar plot

D) Creates a pie chart

Answer: A) Creates a line plot

13. Which function is used to create a heatmap in base R?

A) heatmap()

B) map()

C) geom_tile()

D) scale_fill()

Answer: A) heatmap()

14. How can you add a legend to a ggplot2 plot?

A) theme_legend()

B) add_legend()

C) legend()

D) ggplot2 handles legends automatically

Answer: D) ggplot2 handles legends automatically

15. Which function is used to save a plot as an image in ggplot2?

A) save_image()

B) ggsave()

C) save_plot()

D) export_plot()
Answer: B) ggsave()

You might also like