MCQs on Basic Visualization | R

In R, creating visualizations using base graphics is an essential skill for data analysis. Mastering plotting functions such as histograms, scatterplots, and barplots, along with graph customization, empowers analysts to present insights effectively.


1. Introduction to Base R Graphics

  1. Which function is used to create a simple plot in Base R?
    a) plot()
    b) ggplot()
    c) hist()
    d) barplot()
  2. In Base R, what is the default plotting device used?
    a) Graphical Device
    b) Plot Window
    c) RGraphics
    d) Ggplot Device
  3. What does the plot() function in R do by default?
    a) Creates a scatter plot
    b) Creates a line plot
    c) Creates a histogram
    d) Creates a bar plot
  4. Which argument in the plot() function controls the type of plot?
    a) plot.type
    b) type
    c) graph.type
    d) chart.type
  5. How do you add a title to a plot in R?
    a) title()
    b) addTitle()
    c) plotTitle()
    d) legend()
  6. Which function is used to create a histogram in Base R?
    a) hist()
    b) barplot()
    c) scatterplot()
    d) plot.hist()
  7. Which graphical parameter is used to change the background color of a plot in R?
    a) bg
    b) col.bg
    c) background
    d) color.bg
  8. In Base R graphics, how do you change the axis labels of a plot?
    a) axis.labels()
    b) xlabel() and ylabel()
    c) xlab() and ylab()
    d) axes()
  9. What does the xlim argument control in a Base R plot?
    a) The limits of the x-axis
    b) The limits of the plot window
    c) The labels on the x-axis
    d) The color of the x-axis
  10. Which function allows adding a legend to a plot in Base R?
    a) addLegend()
    b) legend()
    c) addLabels()
    d) legendTitle()

2. Plotting Functions (Histogram, Scatterplot, Barplot, Boxplot)

  1. Which function is used to create a scatter plot in Base R?
    a) scatterplot()
    b) plot()
    c) xyplot()
    d) bubbleplot()
  2. What is the default plot type for the plot() function?
    a) Line plot
    b) Histogram
    c) Bar plot
    d) Scatter plot
  3. Which function is used to create a bar plot in R?
    a) barplot()
    b) bar()
    c) plot.bar()
    d) bar_graph()
  4. How do you create a boxplot in R using Base graphics?
    a) plot.box()
    b) box()
    c) boxplot()
    d) plotBox()
  5. Which argument in the hist() function specifies the number of bins for a histogram?
    a) bins
    b) breaks
    c) segments
    d) categories
  6. How do you change the color of bars in a bar plot in R?
    a) col.bar
    b) bar.colors
    c) col
    d) fill.color
  7. Which function would you use to add a horizontal line to a plot?
    a) abline()
    b) hline()
    c) addline()
    d) line()
  8. How do you create a stacked bar plot in R?
    a) Use the barplot() function with the beside = FALSE argument
    b) Use stacked.barplot()
    c) Use hist() with the stack = TRUE argument
    d) Use plot() with the type = "stack" argument
  9. Which of the following arguments can be used to adjust the size of points in a scatter plot?
    a) pch
    b) cex
    c) size
    d) points.size
  10. How do you add grid lines to a Base R plot?
    a) grid()
    b) addGrid()
    c) gridlines()
    d) addGridlines()

3. Customizing Graphs

  1. Which argument is used to modify the title size in a plot in R?
    a) title.size
    b) cex.main
    c) main.size
    d) title.text
  2. How can you change the color of the plot’s points in Base R?
    a) pch
    b) col
    c) color.points
    d) point.color
  3. How do you change the line type in a Base R plot?
    a) type.line
    b) lty
    c) line.type
    d) plot.line
  4. What argument in plot() can be used to change the plot’s background color?
    a) bg
    b) plot.bg
    c) background.color
    d) col.bg
  5. How can you add text to a specific point on a plot in R?
    a) text()
    b) addText()
    c) plotText()
    d) label()
  6. Which argument in hist() allows you to set the appearance of the histogram’s bars?
    a) style
    b) col
    c) fill
    d) color.bar
  7. How do you specify the range of the y-axis in a plot in R?
    a) ylim
    b) y.range
    c) yaxis.range
    d) axis.y
  8. How do you create a plot with no axes in Base R?
    a) axes = FALSE
    b) noaxes = TRUE
    c) plot() without specifying axes
    d) plot(axes = FALSE)
  9. Which argument in the barplot() function controls the width of the bars?
    a) bar.width
    b) width
    c) density
    d) space
  10. How can you add a custom axis to a plot in R?
    a) customAxis()
    b) axis()
    c) addAxis()
    d) plot.axis()

Answers Table

QNoAnswer (Option with Text)
1a) plot()
2b) Plot Window
3a) Creates a scatter plot
4b) type
5a) title()
6a) hist()
7a) bg
8c) xlab() and ylab()
9a) The limits of the x-axis
10b) legend()
11b) plot()
12d) Scatter plot
13a) barplot()
14c) boxplot()
15b) breaks
16c) col
17a) abline()
18a) Use the barplot() function with the beside = FALSE argument
19b) cex
20a) grid()
21b) cex.main
22b) col
23b) lty
24a) bg
25a) text()
26b) col
27a) ylim
28a) axes = FALSE
29b) width
30b) axis()

Use a Blank Sheet, Note your Answers and Finally tally with our answer at last. Give Yourself Score.

X
error: Content is protected !!
Scroll to Top