STATE PUBLIC SCHOOL, JALANDHAR CANTT
Assignment: MCQs on Matplotlib
Class – XII | Subject – Informatics Practices | Topic – Python Data Visualization
(Matplotlib)
Answer the following multiple-choice questions by choosing the correct option.
1. Which of the following imports pyplot correctly?
a) import matplotlib.pyplot
b) import matplotlib as pltc) import matplotlib.pyplot as plt
d) from matplotlib import plot
2. Which function is used to create a line graph?
a) line()
b) graph()
c) plt.plot()
d) plt.linegraph()
3. Which function is used to display the plot?
a) plt.show()
b) plt.display()
c) plt.plot()
d) plt.run()
4. Which method sets the x-axis label?
a) plt.labelx()
b) plt.xaxis()
c) plt.xlabel()
d) plt.xname()
5. What is used to add a title to a graph?
a) plt.name()
b) plt.graphTitle()
c) plt.title()
d) plt.label()
6. What is the function to create a bar chart?
a) plt.barchart()
b) plt.bar()
c) plt.plotbar()
d) plt.column()
7. What is the default line style in plt.plot()?
a) Dotted
b) Solid
c) Dashed
d) None
8. Which function is used to draw a bar chart?
a) barplot()
b) bar()
c) plotbar()
d) drawbar()
9. How do you display a Matplotlib graph?
a) plt.graph()
b) plt.display()
c) plt.show()
d) plt.open()
10. How do you label the x-axis of a graph?
a) x.label()
b) plt.xaxis()
c) plt.xlabel()
d) plt.x()11. How do you label the y-axis of a graph?
a) y.label()
b) plt.ylabel()
c) plt.yaxis()
d) plt.y()
12. Which function is used to set the title of the graph?
a) plt.settitle()
b) plt.name()
c) plt.title()
d) plt.heading()
13. What does plt.grid(True) do?
a) Draws a table
b) Shows grid lines on the graph
c) Draws boxes around data points
d) Hides the axes
14. What is the default color of a line in Matplotlib?
a) Red
b) Blue
c) Black
d) Green
15. Which function is used to create a pie chart?
16. How do you add a legend to a graph?
17. Which argument in plt.plot() sets the color of the line?
18. Which argument is used to change line style in plt.plot()?
19. What does '--' signify in line style?
20. What does 'o' indicate in a plot?
21. What does plt.figure() do?
22. Which method is used to save the plot to a file?
23. Which format is supported by plt.savefig()?
24. What does plt.subplot(2,2,1) indicate?
25. Which function is used to create a horizontal bar chart?
26. Which method is used to draw a histogram?
27. What does the bins parameter define in a histogram?
28. What is the default orientation of a bar chart?
29. Which module is used to draw graphs in Python?
30. What does the alpha parameter control?
31. What is the use of label in a plot function?
32. Which function changes the figure size?
33. What does plt.xticks() modify?
34. What does plt.yticks() modify?