Python Seaborn Charts Quiz

Python
0 Passed
0% acceptance

A 35-question quiz covering Seaborn's high-level plotting interface, including scatter plots, categorical charts, distributions, themes, and statistical visualizations.

35 Questions
~70 minutes
1

Question 1

Which Seaborn function is the primary interface for drawing scatter plots to visualize the relationship between two numeric variables?

A
sns.scatter()
B
sns.scatterplot()
C
sns.pointplot()
D
sns.dotplot()
2

Question 2

How do you map a third variable to the color of the points in a scatter plot?

javascript

import seaborn as sns
sns.scatterplot(data=df, x='total_bill', y='tip', ____='sex')
                
A
color
B
c
C
hue
D
palette
3

Question 3

What is the difference between `scatterplot()` and `relplot()`?

A
`scatterplot` is an Axes-level function; `relplot` is a Figure-level function that can create subplots.
B
`relplot` is older and deprecated.
C
`scatterplot` supports 3D plots, `relplot` does not.
D
They are identical aliases.
4

Question 4

You want to vary the size of points based on the 'size' column. Which parameter do you use?

javascript

sns.scatterplot(data=tips, x='total_bill', y='tip', ____='size')
                
A
size
B
scale
C
radius
D
s
5

Question 5

How can you change the marker style based on a categorical variable 'time'?

A
sns.scatterplot(..., style='time')
B
sns.scatterplot(..., marker='time')
C
sns.scatterplot(..., shape='time')
D
sns.scatterplot(..., symbol='time')
6

Question 6

What happens if you pass a categorical variable to the `x` axis of `scatterplot`?

A
It raises an error; scatter plots require numeric x and y.
B
It creates a strip plot where points are aligned vertically.
C
It automatically converts categories to integers 0, 1, 2...
D
It draws nothing.
7

Question 7

Which function creates a bar chart displaying the mean of a numeric variable per category with error bars?

A
sns.countplot()
B
sns.barplot()
C
sns.histogram()
D
sns.meanplot()
8

Question 8

What does a `boxplot` visualize?

A
The mean and standard deviation.
B
The distribution quartiles (median, 25th, 75th percentiles) and outliers.
C
A 3D box representation of data.
D
The cumulative distribution.
9

Question 9

Which plot combines a box plot with a kernel density estimation (KDE) to show the distribution shape?

A
sns.violinplot()
B
sns.kdeplot()
C
sns.swarmplot()
D
sns.boxenplot()
10

Question 10

How do you count the number of observations in each category without a 'y' variable?

javascript

sns.____(data=df, x='category')
                
A
barplot
B
countplot
C
histplot
D
catplot
11

Question 11

What is the advantage of `swarmplot` over `stripplot`?

A
It runs faster.
B
It adjusts points horizontally so they don't overlap, giving a better sense of density.
C
It allows for 3D visualization.
D
It calculates the mean automatically.
12

Question 12

Which Figure-level function gives access to all categorical plot types (box, violin, bar, etc.) via the `kind` parameter?

A
sns.catplot()
B
sns.factorplot()
C
sns.plot_categorical()
D
sns.gridplot()
13

Question 13

Which function is best for plotting a univariate histogram?

A
sns.histplot()
B
sns.distplot()
C
sns.bar()
D
sns.count()
14

Question 14

What does a KDE (Kernel Density Estimate) plot represent?

A
The exact count of data points.
B
A smoothed, continuous probability density curve of the data.
C
The cumulative sum of the data.
D
A regression line.
15

Question 15

How do you add a KDE curve to a histogram?

javascript

sns.histplot(data=df, x='value', ____=True)
                
A
density
B
kde
C
curve
D
smooth
16

Question 16

Which function visualizes the bivariate distribution of two variables using contour lines or hex bins?

A
sns.jointplot()
B
sns.pairplot()
C
sns.displot()
D
All of the above can do it.
17

Question 17

What is `ecdfplot` used for?

A
Plotting the Empirical Cumulative Distribution Function.
B
Plotting error bars.
C
Plotting economic data.
D
Plotting exponential curves.
18

Question 18

How does `rugplot` visualize distribution?

A
It draws a carpet-like texture.
B
It draws small vertical ticks at each observation along the axis.
C
It fills the area under the curve.
D
It connects points with a rugged line.
19

Question 19

Which function sets the global visual theme (background, grid, fonts) for Seaborn plots?

A
sns.set_style()
B
sns.set_theme()
C
sns.apply_theme()
D
sns.style()
20

Question 20

Which of the following is NOT a built-in Seaborn style?

A
darkgrid
B
whitegrid
C
ticks
D
ggplot2
21

Question 21

How do you retrieve a color palette with 10 distinct colors?

javascript

colors = sns.color_palette(____, 10)
                
A
None (default)
B
'pastel'
C
'husl'
D
Any of the above
22

Question 22

What type of palette is best for sequential numeric data (e.g., temperature)?

A
Qualitative (e.g., 'deep')
B
Sequential (e.g., 'viridis' or 'rocket')
C
Diverging (e.g., 'vlag')
D
Random
23

Question 23

How do you temporarily set a style for a single plot using a context manager?

javascript

with sns.____("white"):
    sns.scatterplot(...)
                
A
axes_style
B
set_style
C
style_context
D
theme
24

Question 24

Which function scales plot elements (font size, line width) for different contexts like 'paper', 'notebook', 'talk', or 'poster'?

A
sns.set_context()
B
sns.set_scale()
C
sns.resize()
D
sns.zoom()
25

Question 25

What does `sns.regplot()` draw?

A
A scatter plot with a linear regression line and a confidence interval.
B
A regular line chart.
C
A logistic regression curve only.
D
A residual plot.
26

Question 26

Which function creates a matrix of scatter plots for every pair of variables in a dataset?

A
sns.matrixplot()
B
sns.pairplot()
C
sns.heatmap()
D
sns.corrmatrix()
27

Question 27

How do you visualize a correlation matrix as a color-coded grid?

javascript

corr = df.corr()
sns.____(corr)
                
A
heatmap
B
colorgrid
C
matrix
D
implot
28

Question 28

What does `lmplot()` offer over `regplot()`?

A
It is faster.
B
It is a Figure-level function that supports faceting (creating subplots based on other variables).
C
It supports 3D regression.
D
It uses machine learning.
29

Question 29

What does the `residplot()` function visualize?

A
The residuals of a linear regression (difference between observed and predicted values).
B
The resident data in memory.
C
The resistance of the model.
D
The R-squared value.
30

Question 30

In a `jointplot`, what is the default 'kind' of plot in the center?

A
kde
B
scatter
C
hex
D
reg
31

Question 31

How do you separate charts into columns based on a categorical variable 'region' in `relplot`?

javascript

sns.relplot(data=df, x='x', y='y', ____='region')
                
A
hue
B
style
C
col
D
split
32

Question 32

Which parameter allows you to specify the order of categories on the x-axis?

A
sort_order
B
order
C
rank
D
sequence
33

Question 33

How do you rotate x-axis labels to prevent overlap?

A
sns.set_xticklabels(rotation=45)
B
Use Matplotlib: plt.xticks(rotation=45)
C
sns.rotate_labels(45)
D
It happens automatically.
34

Question 34

What does the `ci` parameter control in bar plots and line plots?

A
Color Intensity.
B
Confidence Interval (default 95%).
C
Chart Index.
D
Circle Indicator.
35

Question 35

How do you move the legend outside the plot in a `scatterplot`?

A
sns.move_legend(ax, 'upper left', bbox_to_anchor=(1, 1))
B
sns.legend(outside=True)
C
It is not possible.
D
Use plt.legend(loc='outside')

QUIZZES IN Python