Unit 12: Data visualization - Practice Quiz

ECAP776 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 What is Seaborn primarily used for in Python?

Introduction to seaborn Easy
A. Creating statistical data visualizations
B. Building desktop user interfaces
C. Managing relational database tables
D. Compiling Python source code

2 Which import statement uses the conventional alias for Seaborn?

Introduction to seaborn Easy
A. import seaborn as sea
B. import seaborn as snb
C. import seaborn as sns
D. import seaborn as sbn

3 Seaborn is built on top of which Python plotting library?

Introduction to seaborn Easy
A. Requests
B. NumPy
C. Tkinter
D. Matplotlib

4 Which type of data is Seaborn especially useful for exploring?

Introduction to seaborn Easy
A. Audio data
B. Binary files
C. Source code
D. Statistical data

5 Which Seaborn function applies a default visual theme to plots?

Introduction to seaborn Easy
A. sns.draw_theme()
B. sns.open_theme()
C. sns.make_theme()
D. sns.set_theme()

6 Which Seaborn function can load one of the library's example datasets?

Introduction to seaborn Easy
A. sns.open_dataset()
B. sns.load_dataset()
C. sns.read_dataset()
D. sns.make_dataset()

7 Which library generally provides a higher-level interface for statistical plotting?

Seaborn vs matplotlib Easy
A. Seaborn
B. Matplotlib
C. NumPy
D. Pandas

8 Which library usually offers more detailed, low-level control over plot elements?

Seaborn vs matplotlib Easy
A. Matplotlib
B. Requests
C. Seaborn
D. SciPy

9 Which statement correctly describes the relationship between Seaborn and Matplotlib?

Seaborn vs matplotlib Easy
A. Matplotlib stores Seaborn datasets
B. Seaborn replaces the Python language
C. Matplotlib requires Seaborn underneath
D. Seaborn uses Matplotlib underneath

10 Which library commonly provides attractive default themes and color palettes with less configuration?

Seaborn vs matplotlib Easy
A. PyGame
B. SQLite
C. Seaborn
D. Matplotlib

11 Can Seaborn and Matplotlib be used together in the same program?

Seaborn vs matplotlib Easy
A. Only when Python is offline
B. Yes, they can work together
C. Only when no data is used
D. No, they always conflict

12 Why might a beginner choose Seaborn for statistical graphics?

Seaborn vs matplotlib Easy
A. It automatically writes complete programs
B. It creates many plots with concise code
C. It converts charts into databases
D. It removes the need for Python

13 Which Seaborn function creates a scatter plot?

Data visualization using seaborn Easy
A. sns.barplot()
B. sns.boxplot()
C. sns.lineplot()
D. sns.scatterplot()

14 Which Seaborn function is commonly used to draw a line plot?

Data visualization using seaborn Easy
A. sns.heatmap()
B. sns.histplot()
C. sns.lineplot()
D. sns.countplot()

15 Which Seaborn function displays the distribution of a numeric variable using bins?

Data visualization using seaborn Easy
A. sns.scatterplot()
B. sns.histplot()
C. sns.barplot()
D. sns.lineplot()

16 Which Seaborn function is used to create a box plot?

Data visualization using seaborn Easy
A. sns.countplot()
B. sns.lineplot()
C. sns.scatterplot()
D. sns.boxplot()

17 Which Seaborn function displays values in a color-coded matrix?

Data visualization using seaborn Easy
A. sns.lineplot()
B. sns.histplot()
C. sns.barplot()
D. sns.heatmap()

18 Which parameter commonly assigns plot colors according to a data variable?

Data visualization using seaborn Easy
A. hue
B. style
C. alpha
D. size

19 Which Seaborn function shows the number of observations in each category?

Data visualization using seaborn Easy
A. sns.heatmap()
B. sns.scatterplot()
C. sns.countplot()
D. sns.lineplot()

20 In sns.scatterplot(data=df, x="height", y="weight"), what does the x parameter specify?

Data visualization using seaborn Easy
A. The color assigned to each point
B. The variable on the horizontal axis
C. The title displayed above the plot
D. The variable on the vertical axis

21 Which feature of Seaborn most directly simplifies plotting variables from a pandas DataFrame?

Introduction to seaborn Medium
A. Converting columns into Python lists
B. Mapping column names to visual properties
C. Compiling columns into NumPy functions
D. Storing each column in a subplot

22 A program uses import seaborn as sns. Which call applies a Seaborn theme to subsequent plots?

Introduction to seaborn Medium
A. sns.load_theme(style="whitegrid")
B. sns.set_theme(style="whitegrid")
C. sns.apply_style(theme="whitegrid")
D. sns.plot_theme(name="whitegrid")

23 Which data organization works most naturally with Seaborn's x, y, and hue semantic mappings?

Introduction to seaborn Medium
A. A collection of image arrays
B. A formatted text table
C. A nested dictionary only
D. A long-form DataFrame

24 A notebook needs larger labels and lines for a presentation. Which Seaborn setting is most appropriate?

Introduction to seaborn Medium
A. sns.set_context("talk")
B. sns.set_style("ticks")
C. sns.despine(offset=10)
D. sns.color_palette("deep")

25 Why might a developer choose Seaborn over Matplotlib for comparing a numeric variable across categories?

Seaborn vs matplotlib Medium
A. Seaborn stores plotted data in database tables
B. Seaborn provides concise statistical plot functions
C. Seaborn avoids using graphical rendering backends
D. Seaborn replaces all pandas data operations

26 After creating ax = sns.scatterplot(...), how should a custom title be added using Matplotlib's object-oriented interface?

Seaborn vs matplotlib Medium
A. plt.axes_title("Results")
B. ax.make_title("Results")
C. sns.title(ax, "Results")
D. ax.set_title("Results")

27 Which statement correctly compares sns.scatterplot() and sns.relplot(kind="scatter")?

Seaborn vs matplotlib Medium
A. Both functions require manually created subplot axes
B. Both functions always return a Matplotlib Figure
C. scatterplot() is figure-level; relplot() is axes-level
D. scatterplot() is axes-level; relplot() is figure-level

28 A chart requires individually positioned annotations, custom arrows, and precise control of every axis element. Which approach is generally most suitable?

Seaborn vs matplotlib Medium
A. Use pandas without a plotting backend
B. Use Seaborn's dataset loader
C. Use only Seaborn's default theme
D. Use Matplotlib's lower-level API

29 Why can Matplotlib commands usually customize a chart created by Seaborn?

Seaborn vs matplotlib Medium
A. Matplotlib converts charts into DataFrames
B. Seaborn builds its charts on Matplotlib
C. Seaborn and Matplotlib share no dependencies
D. Matplotlib executes Seaborn through pandas

30 A scatter plot must distinguish species by both color and marker shape. Which call performs this mapping?

Data visualization using seaborn Medium
A. sns.scatterplot(data=df, x="length", y="mass", bins="species", fill="species")
B. sns.scatterplot(data=df, x="length", y="mass", hue="species", style="species")
C. sns.scatterplot(data=df, x="length", y="mass", row="species", col="species")
D. sns.scatterplot(data=df, x="length", y="mass", size="species", alpha="species")

31 A DataFrame contains repeated time values for several devices. Which call draws one unaggregated line per device?

Data visualization using seaborn Medium
A. sns.lineplot(data=df, x="time", y="value", size="device", estimator="mean")
B. sns.lineplot(data=df, x="time", y="value", style=None, estimator="median")
C. sns.lineplot(data=df, x="time", y="value", hue="device", estimator=None)
D. sns.lineplot(data=df, x="time", y="value", hue=None, estimator="sum")

32 In a standard Seaborn box plot, what does a point plotted beyond a whisker usually represent?

Data visualization using seaborn Medium
A. A missing observation
B. The sample median
C. A potential outlier
D. The category mean

33 A student wants to compare the distribution shape and quartiles of scores for several classes. Which plot is most suitable?

Data visualization using seaborn Medium
A. sns.violinplot(x="class", y="score", inner="quart")
B. sns.countplot(x="class", hue="score", stat="count")
C. sns.scatterplot(x="class", y="score", legend="full")
D. sns.lineplot(x="class", y="score", estimator="sum")

34 Which call compares two groups' distributions in one histogram while keeping both visible through transparency?

Data visualization using seaborn Medium
A. sns.histplot(data=df, x="value", weights="group", multiple="stack", alpha=1.0)
B. sns.histplot(data=df, x="value", hue="group", multiple="layer", alpha=0.5)
C. sns.histplot(data=df, x="value", hue="group", multiple="fill", alpha=1.0)
D. sns.histplot(data=df, x="group", hue="value", multiple="dodge", alpha=1.0)

35 A dataset has one row per customer, and the goal is to display how many customers belong to each membership type. Which function should be used?

Data visualization using seaborn Medium
A. sns.barplot(data=df, x="membership")
B. sns.countplot(data=df, x="membership")
C. sns.regplot(data=df, x="membership")
D. sns.lineplot(data=df, x="membership")

36 A bar plot should show the average salary for each department rather than the number of records. Which call is appropriate?

Data visualization using seaborn Medium
A. sns.histplot(data=df, x="department", weights="salary", stat="count")
B. sns.boxplot(data=df, x="department", y="salary", whis="mean")
C. sns.barplot(data=df, x="department", y="salary", estimator="mean")
D. sns.countplot(data=df, x="department", hue="salary", stat="count")

37 A correlation matrix should display values such as 0.87 inside its cells. Which call provides this result?

Data visualization using seaborn Medium
A. sns.heatmap(corr, labels=True, bins=2)
B. sns.heatmap(corr, annot=True, fmt=".2f")
C. sns.heatmap(corr, annot=False, fmt=".2f")
D. sns.heatmap(corr, values=True, precision=2)

38 Which visualization efficiently examines pairwise relationships among several numeric columns while coloring observations by category?

Data visualization using seaborn Medium
A. sns.heatmap(df, hue="category")
B. sns.boxplot(data=df, hue="category")
C. sns.countplot(data=df, hue="category")
D. sns.pairplot(df, hue="category")

39 A researcher wants separate scatter-plot panels for each region while using the same variable mappings. Which call is appropriate?

Data visualization using seaborn Medium
A. sns.regplot(data=df, x="income", y="spending", row="region", kind="scatter")
B. sns.scatterplot(data=df, x="income", y="spending", col="region", kind="scatter")
C. sns.relplot(data=df, x="income", y="spending", col="region", kind="scatter")
D. sns.histplot(data=df, x="income", y="spending", col="region", kind="scatter")

40 A table contains columns month, city, and temperature, with one observation per city-month pair. What should be done before creating a heatmap with months as rows and cities as columns?

Data visualization using seaborn Medium
A. Pivot the table into a month-by-city matrix
B. Convert every column into categorical codes
C. Sort the table only by temperature values
D. Aggregate all cities into one temperature

41 A figure already contains two Matplotlib subplots created by fig, axs = plt.subplots(1, 2). Which call draws a Seaborn histogram specifically on the second subplot without creating another figure?

Seaborn vs matplotlib Hard
A. sns.displot(data=df, x="value", ax=axs[1])
B. sns.displot(data=df, x="value", figure=axs[1])
C. sns.histplot(data=df, x="value", figure=fig)
D. sns.histplot(data=df, x="value", ax=axs[1])

42 A dataset contains repeated measurements of score at each time. Which capability most directly distinguishes sns.lineplot from a basic plt.plot call?

Seaborn vs matplotlib Hard
A. It guarantees that all observations are connected in their input order.
B. It permanently modifies the DataFrame by replacing each group with its calculated summary statistics.
C. It estimates a central tendency and uncertainty from repeated observations.
D. It converts every numeric variable into a categorical axis automatically.

43 What object is returned by ax2 = sns.scatterplot(data=df, x="x", y="y") when no ax argument is supplied?

Introduction to seaborn Hard
A. The Matplotlib Axes containing the plot
B. The Matplotlib Figure containing the plot
C. A modified copy of the supplied DataFrame
D. A Seaborn FacetGrid containing one facet

44 An Axes and several artists have already been created before sns.set_theme(style="darkgrid") is called. Which statement best describes the effect?

Introduction to seaborn Hard
A. It recursively restyles every existing artist and recreates each legend.
B. It changes the stored data values so future plots follow the selected theme.
C. It affects only Seaborn objects and leaves Matplotlib defaults unchanged.
D. It changes global defaults but does not rewrite existing artist properties.

45 A table has columns control, low_dose, and high_dose, with one measurement per row in each column. You need sns.relplot with treatment mapped to both hue and col. Which transformation is most appropriate?

Data visualization using seaborn Hard
A. Transpose the table and use its integer index as the hue.
B. Compute a correlation matrix before passing the table to relplot.
C. Join the treatment columns into one formatted string column.
D. Melt the columns into treatment and measurement variables.

46 Under current Seaborn defaults, what happens when sns.lineplot(data=df, x="time", y="response") receives many response observations at each time value?

Data visualization using seaborn Hard
A. It plots the median response with an interquartile-range uncertainty band.
B. It plots the mean response with a bootstrapped 95% confidence interval.
C. It connects every row separately while preserving the DataFrame row order.
D. It selects one response randomly at each time and interpolates missing values.

47 A longitudinal dataset contains subject, time, and score. Which call draws one trajectory per subject without adding every subject identifier to the legend?

Data visualization using seaborn Hard
A. sns.lineplot(data=df, x="time", y="score", style="subject", errorbar=None)
B. sns.lineplot(data=df, x="time", y="score", hue="subject", estimator="mean")
C. sns.lineplot(data=df, x="time", y="score", units="subject", estimator=None)
D. sns.lineplot(data=df, x="time", y="score", size="subject", estimator="median")

48 In sns.histplot(data=df, x="value", hue="group", stat="density", common_norm=True), how are overlaid group densities normalized?

Data visualization using seaborn Hard
A. Their combined area is normalized to one.
B. Each group's area is independently normalized to one.
C. Each bar height is divided by that group's maximum.
D. Every group is first resampled to equal size and then normalized using a separate kernel-density estimate.

49 Consider sns.histplot(data=df, x="amount", bins=10, log_scale=True) where amount includes zero and positive values spanning several orders of magnitude. Which interpretation is correct?

Data visualization using seaborn Hard
A. Bins remain equally spaced in raw coordinates, and zero is displayed at log position zero.
B. A constant of one is automatically added to every amount before computing the bins.
C. The counts are logarithmically transformed, but the horizontal axis remains linear.
D. Bins are spaced in log coordinates, while nonpositive values cannot be represented.

50 What does g = sns.catplot(data=df, x="group", y="score", col="site", kind="box") return, and where should facet-wide customization be applied?

Introduction to seaborn Hard
A. A list of box artists; modify each artist's DataFrame.
B. A single Axes; use methods such as g.set_xlabel().
C. A Figure; use methods such as g.set_axis_labels().
D. A FacetGrid; use methods such as g.set_axis_labels().

51 A custom plotting function expects a facet subset as data and receives column names through x and y. Which FacetGrid method is designed for this interface?

Data visualization using seaborn Hard
A. g.map_dataframe(custom_func, x="time", y="value")
B. g.pipe(custom_func, x="time", y="value", facet=True)
C. g.apply_dataframe(custom_func, "time", "value")
D. g.map(custom_func, "time", "value", data=df)

52 A categorical scatter plot uses numeric years 2000, 2005, and 2020 on the categorical axis. Which setting preserves the unequal numeric spacing instead of placing the years at ordinal positions 0, 1, and 2?

Data visualization using seaborn Hard
A. Set dodge="auto".
B. Set log_scale=False.
C. Set native_scale=True.
D. Set formatter=str.

53 A heatmap contains values from to and is drawn with sns.heatmap(data, center=0, cmap="vlag") but without vmin or vmax. What should be expected?

Data visualization using seaborn Hard
A. The displayed limits are automatically forced to exactly and .
B. The values are standardized to mean zero and unit variance before plotting.
C. Zero uses the colormap's central color, but limits need not be symmetric.
D. All negative values are clipped because the center is below the midpoint.

54 For a square correlation matrix corr, which mask hides only the entries strictly above the main diagonal while retaining the diagonal and lower triangle?

Data visualization using seaborn Hard
A. np.tril(np.ones_like(corr, dtype=bool), k=-1)
B. np.triu(np.ones_like(corr, dtype=bool), k=0)
C. np.triu(np.ones_like(corr, dtype=bool), k=1)
D. np.eye(len(corr), dtype=bool)

55 Which statement correctly describes sns.clustermap when integrating it into an existing Matplotlib layout?

Seaborn vs matplotlib Hard
A. It draws on any supplied Axes and returns that Axes.
B. It returns a reordered DataFrame without creating a figure.
C. It attaches dendrogram artists to the current axes and then returns a detailed dictionary containing every linkage calculation.
D. It creates its own figure and returns a ClusterGrid.

56 You need separate regression panels by region, with a regression line and scatter plot in each panel. Which choice uses Seaborn's appropriate abstraction directly?

Seaborn vs matplotlib Hard
A. plt.plot(data=df, x="x", y="y", col="region")
B. sns.residplot(data=df, x="x", y="y", facet="region")
C. sns.lmplot(data=df, x="x", y="y", col="region")
D. sns.regplot(data=df, x="x", y="y", col="region")

57 A FacetGrid maps sns.histplot over subsets with very different ranges. Automatic bin selection produces different bin edges in each panel, making heights hard to compare. What is the most reliable correction?

Data visualization using seaborn Hard
A. Sort each facet's observations before calling the histogram function.
B. Set sharex=True and allow each facet to calculate its own bins.
C. Normalize each facet by its maximum bar height after rendering.
D. Compute global bin edges once and pass the same bins to every facet.

58 Two separate scatter plots map the same numeric variable to hue, but each plot contains a different subset of its range. How can identical values be guaranteed to receive identical colors across both plots?

Data visualization using seaborn Hard
A. Use legend="full" and let each plot infer its own normalization.
B. Use the same continuous palette and the same explicit hue_norm limits.
C. Call sns.color_palette() before each plot without assigning its result.
D. Convert the hue values to strings and use each subset's default palette.

59 In sns.boxplot(data=df, x="group", y="value", whis=(5, 95)), what do the whisker endpoints represent?

Data visualization using seaborn Hard
A. A bootstrapped 95% confidence interval for the mean
B. Exactly 1.5 interquartile ranges from each quartile
C. The 5th and 95th percentiles within each group
D. The minimum and maximum after removing all duplicated observations

60 A box plot and strip plot are overlaid on the same axes, both using hue="treatment". The legend contains duplicate entries. Assuming the box-plot legend should be retained, what is the cleanest preventive approach?

Data visualization using seaborn Hard
A. Assign a different treatment palette to each plotting function.
B. Pass hue=None to both calls after drawing the artists.
C. Clear the axes legend before creating the box plot.
D. Pass legend=False to the overlaid strip-plot call.