🌍 All Study Guides📊 Dashboard📰 Blog💡 About
Google Data Analytics Professional Certificate • STUDY MODE

PRACTICE QUIZ

QUESTION 1 OF 41

Which of the following are operations you can perform in ggplot2? Select all that apply.

A
Add a title and subtitle to your plotCorrect Answer
B
Create scatterplots and bar chartsCorrect Answer
C
Automatically clean data before creating a plot
D
Change the colors and dimensions of your plotCorrect Answer
QUESTION 2 OF 41

Which ggplot function is used to define the mappings of variables to visual representations of data?

A
ggplot()
B
aes()Correct Answer
C
annotate()
D
mapping()
QUESTION 3 OF 41

A data analyst creates a plot using the following code chunk: ggplot(data = penguins) + geom_point(mapping = aes(x = flipper_length_mm, y = body_mass_g)) Which of the following represents a function in the code chunk? Select all that apply.

A
The geom_point functionCorrect Answer
B
The aes functionCorrect Answer
C
The ggplot functionCorrect Answer
D
The data function
QUESTION 4 OF 41

A data analyst is working with the following plot and gets an error caused by a bug. What is the cause of the bug? ggplot(data = penguins) + geom_point(mapping = aes(x = flipper_length_mm, y = body_mass_g)

A
The plus sign should be at the beginning of the second line.
B
A missing closing parenthesis needs to be added.Correct Answer
C
The code uses a plus sign instead of a pipe.
D
A function name needs to be capitalized.
QUESTION 5 OF 41

You are working with the penguins dataset. You create a scatterplot with the following lines of code: ggplot(data = penguins) + geom_point(mapping = aes(x = flipper_length_mm, y = body_mass_g)) + What code chunk do you add to the third line to save your plot as a pdf file with “penguins” as the file name?

A
ggsave(penguins.pdf)
B
ggsave(=penguins)
C
ggsave(“penguins.pdf”)Correct Answer
D
ggsave(“pdf.penguins”)
QUESTION 6 OF 41

Which of the following are benefits of using ggplot2? Select all that apply.

A
Customize the look and feel of visualsCorrect Answer
B
Make complex data easier to understandCorrect Answer
C
Create plots using a single function
D
Automatically version control plots
QUESTION 7 OF 41

In ggplot2, what symbol do you use to add layers to your plot?

A
The pipe operator (%>%)
B
The ampersand symbol (&)
C
The plus sign (+)Correct Answer
D
The equals sign (=)
QUESTION 8 OF 41

A data analyst creates a plot using the following code chunk: ggplot(data = buildings) + geom_bar(mapping = aes(x = construction_year, color = height)) Which of the following represents a variable in the code chunk?

A
construction_yearCorrect Answer
B
data
C
ggplot
D
mapping
QUESTION 9 OF 41

Which code snippet will make all of the bars in the plot have different colors based on their heights? geom_bar(mapping = aes(x = construction_year)) + color(“height”) geom_bar(mapping = aes(x = construction_year), color=height) geom_bar(mapping = aes(x = construction_year, color=height)) (CORRECT) geom_bar(mapping = aes(x = construction_year)) + color(height)

A
ggplot(data = buildings) +
B
ggplot(data = buildings) +
C
ggplot(data = buildings) +
D
ggplot(data = buildings) +
QUESTION 10 OF 41

A data analyst is working with the penguins data. The analyst creates a scatterplot with the following code: ggplot(data = penguins) + geom_point(mapping = aes(x = flipper_length_mm, y = body_mass_g, alpha = species)) What does the alpha aesthetic do to the appearance of the points on the plot?

A
Makes the points on the plot larger
B
Makes the points on the plot more colorful
C
Makes some points on the plot more transparentCorrect Answer
D
Makes the points on the plot smaller
QUESTION 11 OF 41

What function creates a scatterplot and then adds a small amount of random noise to each point in the plot to make the points easier to find?

A
The geom_jitter() functionCorrect Answer
B
The geom_smooth() function
C
The geom_point() function
D
The geom_bar() function
QUESTION 12 OF 41

A data analyst uses the annotate() function to create a text label for a plot. Which attributes of the text can the analyst change by adding code to the argument of the annotate() function? Select all that apply.

A
Change the text into a title for the plot.
B
Change the size of the text.Correct Answer
C
Change the font style of the text.Correct Answer
D
Change the color of the text.Correct Answer
QUESTION 13 OF 41

You are working with the penguins dataset. You create a scatterplot with the following lines of code: ggplot(data = penguins) + geom_point(mapping = aes(x = flipper_length_mm, y = body_mass_g)) + What code chunk do you add to the third line to save your plot as a png file with “penguins” as the file name?

A
ggsave(“png.penguins”)
B
ggsave(penguins.png)
C
ggsave(“penguins.png”)Correct Answer
D
ggsave(“penguins”)
QUESTION 14 OF 41

Which of the following tasks can you complete with ggplot2 features? Select all that apply.

A
Add labels and annotations to a plotCorrect Answer
B
Automatically clean data before creating a plot
C
Create many different types of plotsCorrect Answer
D
Customize the visual features of a plotCorrect Answer
QUESTION 15 OF 41

Which code snippet will make all of the bars in the plot have different colors and shapes based on their heights? geom_bar(mapping = aes(x = construction_year)) + color(height) + shape(height) geom_bar(mapping = aes(x = construction_year, color=height, shape=height)) (CORRECT) geom_bar(mapping = aes(x = construction_year, color=[height, height])) geom_bar(mapping = aes(x = construction_year, color=height), aes(shape=height))

A
ggplot(data = buildings) +
B
ggplot(data = buildings) +
C
ggplot(data = buildings) +
D
ggplot(data = buildings) +
QUESTION 16 OF 41

A data analyst is working with the following plot and gets an error caused by a bug. What is the cause of the bug? ggplot(data = penguins) + geom_point(mapping = aes(x = flipper_length_mm, y = body_mass_g))

A
A missing closing parenthesis needs to be added.
B
A function name needs to be capitalized.
C
The plus should be at the end of the fist line.Correct Answer
D
The code uses a plus sign instead of a pipe.
QUESTION 17 OF 41

A data analyst creates a plot with the following code chunk: ggplot(data = penguins) + geom_jitter(mapping = aes(x = flipper_length_mm, y = body_mass_g)) What does the geom_jitter() function do to the points in the plot?

A
Adds a small amount of random shapes at each point in the plot
B
Adds random colors to each point in the plot
C
Adds a small amount of random noise to each point in the plotCorrect Answer
D
Decrease the size of each point in the plot
QUESTION 18 OF 41

Which aesthetic of the geom_smooth function can be used to change the style of the line?

A
line
B
linetypeCorrect Answer
C
linestyle
D
linelook
QUESTION 19 OF 41

Which of the following statements best describes a facet in ggplot?

A
Facets are subplots that display data for each value of a variable.Correct Answer
B
Facets are the text used in and around plots.
C
Facets are the ggplot terminology for a chart axis.
D
Facets are the visual characteristics of geometry objects.
QUESTION 20 OF 41

When creating a plot in ggplot you must set the mapping argument of a function. Which function has the mapping argument?

A
The annotate function
B
The geometric functionCorrect Answer
C
The ggplot function
D
The aesthetic function
QUESTION 21 OF 41

A data analyst creates a plot using the following code chunk: ggplot(data = penguins) + geom_point(mapping = aes(x = flipper_length_mm, y = body_mass_g)) Which of the following represents an aesthetic attribute in the code chunk? Select all that apply.

A
body_mass_g
B
flipper_length_mm
C
xCorrect Answer
D
yCorrect Answer
QUESTION 22 OF 41

A data analyst creates a scatterplot with many data points. The analyst wants to make some points on the plot more transparent than others. What aesthetic should the analyst use?

A
AlphaCorrect Answer
B
Fill
C
Shape
D
Color
QUESTION 23 OF 41

Fill in the blank: You can use the _____ function to put a text label on your plot to call out specific data points.

A
annotate()Correct Answer
B
geom_smooth()
C
facet_grid()
D
ggplot()
QUESTION 24 OF 41

A data analyst has a scatter plot with crowded points that make it hard to identify a trend. What geometry function can they add to their plot to clearly indicate the trend of the data?

A
geom_bar()
B
geom_smooth()Correct Answer
C
geom_jitter()
D
geom_alpha()
QUESTION 25 OF 41

A data analyst is working with the following plot and gets an error caused by a bug. What is the cause of the bug? ggplot(data = penguins) %>% geom_point(mapping = aes(x = flipper_length_mm, y = body_mass_g))

A
A missing closing parenthesis needs to be added.
B
A function name needs to be capitalized.
C
The pipe should be at the beginning of the second line.
D
The code uses a pipe instead of a plus sign.Correct Answer
QUESTION 26 OF 41

Fill in the blank: In ggplot2, the term mapping refers to the connection between variables and _____ .

A
aestheticsCorrect Answer
B
facets
C
geoms
D
data frames
QUESTION 27 OF 41

A data analyst creates a bar chart with the diamonds dataset. They begin with the following line of code: ggplot(data = diamonds) What symbol should the analyst put at the end of the line of code to add a layer to the plot?

A
The plus sign (+)Correct Answer
B
The ampersand symbol (&)
C
The equals sign (=)
D
The pipe operator (%>%)
QUESTION 28 OF 41

You are working with the penguins dataset. You create a scatterplot with the following code: ggplot(data = penguins) + geom_point(mapping = aes(x = flipper_length_mm, y = body_mass_g)) You want to highlight the different years of data collection on your plot. Add a code chunk to the second line of code to map the aesthetic size to the variable year. NOTE: the three dots (...) indicate where to add the code chunk. You may need to scroll in order to find the dots. geom_point(mapping = aes(x = flipper_length_mm, y = body_mass_g, ...)) What years does your visualization display?

A
2005-2009
B
2007-2009Correct Answer
C
2007-2011
D
2006-2010
Explanation:

You add the code chunk size = year to map the aesthetic size to the variable year. The correct code is ggplot(data = penguins) + geom_point(mapping = aes(x = flipper_length_mm, y = body_mass_g, size = year)). Inside the parentheses of the aes() function, after the comma that follows y = body_mass_g, write the aesthetic (size), then an equals sign, then the variable (year). The data points for the different years now appear in different sizes. Your visualization displays the years 2007-2009.

QUESTION 29 OF 41

Fill in the blank: The _____ creates a scatterplot and then adds a small amount of random noise to each point in the plot to make the points easier to find.

A
geom_jitter() functionCorrect Answer
B
geom_smooth() function
C
geom_point() function
D
geom_bar() function
QUESTION 30 OF 41

What function can be used to facet a plot on two variables?

A
geom_wrap()
B
facet_grid()Correct Answer
C
facet_layout()
D
facet_wrap()
QUESTION 31 OF 41

What argument of the labs() function can a data analyst use to add text outside of the grid area of a plot?

A
text
B
annotate
C
titleCorrect Answer
D
note
QUESTION 32 OF 41

In R studio, what default options does the Export functionality of the Plots tab give for exporting plots?

A
HTML
B
Slideshow
C
ImageCorrect Answer
D
PDFCorrect Answer
QUESTION 33 OF 41

You are working with the penguins dataset. You create a scatterplot with the following code chunk: ggplot(data = penguins) + geom_point(mapping = aes(x = flipper_length_mm, y = body_mass_g)) You want to highlight the different penguin species in your plot. Add a code chunk to the second line of code to map the aesthetic size to the variable bill_depth_mm. NOTE: the three dots (...) indicate where to add the code chunk. You may need to scroll in order to find the dots. geom_point(mapping = aes(x = flipper_length_mm, y = body_mass_g, ...)) Which approximate range of bill depths does your visualization display?

A
20 - 31
B
14 - 20Correct Answer
C
31 - 40
D
2 - 9
QUESTION 34 OF 41

Which of the following is a functionality of ggplot2?

A
Combine data manipulation and visualizations using pipes.Correct Answer
B
Filter and sort data in complex ways.
C
Define complex visualization using a single function.
D
Create plots using artificial intelligence.
QUESTION 35 OF 41

A data analyst creates a scatterplot. The analyst wants to put a text label on the plot to call out specific data points. What function does the analyst use?

A
The annotate() functionCorrect Answer
B
The geom_smooth() function
C
The facet_grid() function
D
The ggplot() function
QUESTION 36 OF 41

You are working with the penguins dataset. You create a scatterplot with the following code chunk: ggplot(data = penguins) + geom_point(mapping = aes(x = flipper_length_mm, y = body_mass_g)) You want to highlight the different penguin species in your plot. Add a code chunk to the second line of code to map the aesthetic shape to the variable species. NOTE: the three dots (...) indicate where to add the code chunk. You may need to scroll in order to find the dots. geom_point(mapping = aes(x = flipper_length_mm, y = body_mass_g, ...)) Which species tends to have the longest flipper length and highest body mass?

A
Chinstrap
B
Adelie
C
GentooCorrect Answer
D
Macaroni
QUESTION 37 OF 41

What is the purpose of the facet_wrap() function?

A
Create text inside a plot area
B
Create subplots of a single variable into separate categoriesCorrect Answer
C
Modify the visual characteristic of a data point
D
Modify ggplot visuals to be three-dimensional
QUESTION 38 OF 41

Which statement about the ggsave() function is correct?

A
ggsave() is the only way to export a plot.
B
ggsave() exports the last plot displayed by default.Correct Answer
C
ggsave() is run from the Plots Tab in RStudio.
D
ggsave() is unable to save .png files.
QUESTION 39 OF 41

A data analyst creates a scatterplot where the points are very crowded, which makes it hard to notice when points are stacked. What change can they make to their scatter plot to make it easier to notice the stacked data points?

A
Change geom_point() to geom_jitter()Correct Answer
B
Change the shape of the points
C
Change ggplot() to ggplot2()
D
Change the color of the points
QUESTION 40 OF 41

A data analyst wants to add a large piece of text above the grid area that clearly defines the purpose of a plot. Which ggplot function can they use to achieve this?

A
annotate()
B
labs()Correct Answer
C
subtitle()
D
title()
QUESTION 41 OF 41

You are working with the diamonds dataset. You create a bar chart with the following code: ggplot(data = diamonds) + geom_bar(mapping = aes(x = color, fill = cut)) + You want to use the facet_wrap() function to display subsets of your data. Add the code chunk that lets you facet your plot based on the variable clarity. ggplot(data = diamonds) + geom_bar(mapping = aes(x = color, fill = cut)) + facet_wrap(~clarity) how many subplots does your visualization show?

A
8
B
9
C
6
D
7Correct Answer

Ready to test your recall?

Which of the following are operations you can perform in ggplot2? Select all that apply.

💡Select all 3 correct answers before submitting (0 of 3 selected).
A
Add a title and subtitle to your plot
B
Create scatterplots and bar charts
C
Automatically clean data before creating a plot
D
Change the colors and dimensions of your plot

How confident are you in this answer?