Loading

Quipoin Menu

Learn • Practice • Grow

python-for-ai / Histograms and Scatter Plots
mcq
Direction: Choose the correct option

Q1.

Which function creates a histogram in Matplotlib?
A. plt.bar()
B. plt.scatter()
C. plt.plot()
D. plt.hist()
Direction: Choose the correct option

Q2.

What does the `bins` parameter control in `plt.hist()`?
A. Color of bins
B. None
C. Width of bins
D. Number of bins (bars)
Direction: Choose the correct option

Q3.

How do you create a scatter plot?
A. plt.plot(x, y, 'o')
B. Both A and B
C. plt.scatter(x, y, marker='o')
D. plt.scatter(x, y)
Direction: Choose the correct option

Q4.

What does `alpha` parameter control in a scatter plot?
A. Color
B. Line width
C. Size of points
D. Transparency
Direction: Choose the correct option

Q5.

How do you add a colorbar to a scatter plot based on a third variable?
A. plt.scatter(x,y, colorbar=True)
B. Both A and B
C. plt.colorbar(z)
D. plt.scatter(x, y, c=z); plt.colorbar()
Direction: Choose the correct option

Q6.

What does `plt.hist2d(x, y)` produce?
A. 2D scatter
B. Heatmap
C. Contour plot
D. 2D histogram (hexbin)
Direction: Choose the correct option

Q7.

How can you overlay a density curve on a histogram?
A. Use `normed=True`
B. Both A and B
C. Use `kde=True`
D. Use `density=True` in `hist()` and `plt.plot` with KDE
Direction: Choose the correct option

Q8.

What is the purpose of `plt.subplots()`?
A. Create a title
B. Create a legend
C. Create a single plot
D. Create multiple subplots in a grid
Direction: Choose the correct option

Q9.

How do you change the marker size in `plt.scatter()`?
A. size parameter
B. c parameter
C. markersize parameter
D. s parameter
Direction: Choose the correct option

Q10.

What does `plt.clf()` do?
A. Saves the figure
B. Creates a new figure
C. Closes the figure
D. Clears the current figure