A. Two smooth curves showing score distributions for groups A and B with shaded areas
B. A bar chart showing counts of scores for groups A and B
C. A scatter plot of scores colored by group
D. A line plot connecting scores in order for each group
Solution
Step 1: Understand sns.kdeplot with hue and fill
The code plots kernel density estimates for 'score' by 'group' with shaded areas.
Step 2: Identify plot type from code
It produces smooth curves (KDE) for groups A and B, not bars, scatter, or line plots.
Final Answer:
Two smooth curves showing score distributions for groups A and B with shaded areas -> Option A
Quick Check:
kdeplot with hue and fill = smooth shaded curves [OK]
Hint: kdeplot with hue and fill shows smooth shaded group distributions [OK]
Common Mistakes:
Confusing KDE plot with bar or scatter plots
Expecting raw data points instead of smooth curves
Ignoring the fill parameter effect
4. The following code throws an error. What is the most likely cause?
import seaborn as sns
sns.kdeplot(data=df, x='value', hue='group', fill='yes')
medium
A. The data parameter cannot be a DataFrame
B. The fill parameter should be a boolean, not a string
C. The x parameter should be a list of columns
D. The hue parameter must be a list, not a string
Solution
Step 1: Check fill parameter type
In seaborn's kdeplot, fill expects True or False, not a string like 'yes'.
Step 2: Validate other parameters
Hue accepts a column name string, x accepts a column name string, data accepts DataFrame. So these are correct.
Final Answer:
The fill parameter should be a boolean, not a string -> Option B
Quick Check:
fill=True/False, not 'yes' [OK]
Hint: fill must be True or False, never a string [OK]
Common Mistakes:
Passing 'yes' or 'no' as fill instead of True/False
Misunderstanding hue parameter type
Thinking data can't be a DataFrame
5. You want to compare the distribution of exam scores for three classes (X, Y, Z) using KDE overlays. Which approach best ensures clear visual comparison?
hard
A. Plot a single KDE curve for all classes combined without grouping
B. Plot histograms for each class on separate subplots without KDE
C. Plot KDE overlays but use the same color for all classes without labels
D. Plot KDE overlays with distinct colors, use hue='class', and add fill=True with transparency
Solution
Step 1: Identify best way to compare multiple groups with KDE
Using hue='class' separates groups, distinct colors differentiate them, and fill=True with transparency helps see overlaps.
Step 2: Evaluate other options
Separate histograms lose overlay comparison, single KDE hides group differences, same color without labels causes confusion.
Final Answer:
Plot KDE overlays with distinct colors, use hue='class', and add fill=True with transparency -> Option D
Quick Check:
Distinct colors + hue + fill = clear KDE overlay [OK]
Hint: Use hue, distinct colors, and fill with transparency for clarity [OK]
Common Mistakes:
Plotting combined KDE without group separation
Using same color for all groups causing confusion
Not using fill or transparency to show overlaps
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.