wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Matplotlib MCQ Questions

Total questions: 30

Worksheet time: 15mins

Name
Class
Date
1.

What is Matplotlib in Python?

a)

A plotting library

b)

A machine learning library

c)

A data manipulation library

d)

A web development library

2.

Which function is used to create a simple line plot in Matplotlib?

a)

plot()

b)

line()

c)

draw()

d)

scatter()

3.

What is the default backend used by Matplotlib?

a)

TkAgg

b)

Qt5Agg

c)

WebAgg

d)

GTK3Agg

4.

Which command is used to display the plot on the screen?

a)

show()

b)

display()

c)

render()

d)

plot()

5.

How can you set the title of a plot?

a)

title()

b)

set_title()

c)

plot_title()

d)

add_title()

6.

What does the function 'xlabel()' do in Matplotlib?

a)

Sets the x-axis label

b)

Sets the y-axis label

c)

Adds a title

d)

Adds a legend

7.

Which function is used to create a scatter plot?

a)

scatter()

b)

plot()

c)

dot()

d)

point()

8.

How can you change the line style in a plot?

a)

linestyle='--'

b)

line='--'

c)

style='--'

d)

stroke='--'

9.

Which method adds a legend to the plot?

a)

legend()

b)

add_legend()

c)

plot_legend()

d)

show_legend()

10.

How can you save a plot as an image?

a)

savefig()

b)

save_image()

c)

export()

d)

plot_save()

11.

Which module within Matplotlib is used for 3D plotting?

a)

mplot3d

b)

pyplot3D

c)

mpl3d

d)

matplotlib3D

12.

How can you plot multiple subplots in a single figure?

a)

subplot()

b)

multiple()

c)

grid()

d)

plot_multiple()

13.

Which argument controls the color of a line plot?

a)

color

b)

linecolor

c)

plot_color

d)

fill_color

14.

What is the default marker used in the 'plot()' function?

a)

None

b)

'o'

c)

'.'

d)

'*'

15.

Which method is used to set the limits of the x-axis?

a)

xlim()

b)

set_xlim()

c)

axis_limit()

d)

range_x()

16.

What does the 'grid()' function do?

a)

Adds gridlines to the plot

b)

Creates subplots

c)

Adds labels

d)

Saves the plot

17.

Which function creates a bar plot?

a)

bar()

b)

plot()

c)

scatter()

d)

line()

18.

How can you rotate the tick labels on the x-axis?

a)

xticks(rotation=45)

b)

xlabel(rotation=45)

c)

rotate_ticks(45)

d)

ticklabel_rotate()

19.

Which function adds annotations to a plot?

a)

annotate()

b)

add_text()

c)

text()

d)

label()

20.

How do you create a pie chart using Matplotlib?

a)

pie()

b)

chart()

c)

plot_pie()

d)

piechart()

21.

Which parameter in 'plot()' sets the line width?

a)

linewidth

b)

thickness

c)

stroke

d)

weight

22.

How can you display logarithmic scale on the y-axis?

a)

set_yscale('log')

b)

yscale='log'

c)

log_y()

d)

logscale_y()

23.

What function can be used to create a histogram?

a)

hist()

b)

bar()

c)

scatter()

d)

plot()

24.

How can you fill the area under a curve?

a)

fill_between()

b)

fill_curve()

c)

area_fill()

d)

curve_fill()

25.

Which function allows customizing tick marks?

a)

tick_params()

b)

set_ticks()

c)

customize_ticks()

d)

adjust_ticks()

26.

What does 'alpha' parameter control in plots?

a)

Transparency

b)

Line style

c)

Line width

d)

Marker size

27.

How can you set the background color of a plot?

a)

set_facecolor()

b)

bgcolor()

c)

plot_color()

d)

facecolor()

28.

Which function is used to create a horizontal bar plot?

a)

barh()

b)

bar_horizontal()

c)

hbar()

d)

horizontal_bar()

29.

What is the purpose of 'tight_layout()' in Matplotlib?

a)

Adjusts subplot spacing

b)

Fixes axis limits

c)

Changes plot size

d)

Sets title alignment

30.

Which function plots the cumulative distribution of data?

a)

ecdf()

b)

plot_cdf()

c)

cumulative()

d)

hist(cumulative=True)