Chapter-3 Plotting Data using Matplotlib — Online MCQ Test
INFORMATICS PRACTICES · Grade 12 · CBSE(NCERT)
Practice Chapter-3 Plotting Data using Matplotlib with a free chapter-wise online MCQ test.
This chapter covers: Matplotlib - Pyplot - line chart - bar graph - histogram - labels - scales - titles - legends.
AI-generated questions from basic to board-exam level, with instant results and explanations.
Chapter-3 Plotting Data using Matplotlib — Important Questions & Answers
Which module in Python is primarily used for data visualization and plotting?
- A. NumPy
- B. Matplotlib
- C. Pandas
- D. SciPy
Answer: B. Matplotlib
Matplotlib is the primary Python library for creating static, animated, and interactive visualizations including charts and graphs.
Matplotlib is the primary Python library for creating static, animated, and interactive visualizations including charts and graphs.
What does 'pyplot' refer to in matplotlib?
- A. A data structure for storing plot data
- B. A state-based interface for matplotlib
- C. A function to export plots to PDF
- D. A library for statistical analysis
Answer: B. A state-based interface for matplotlib
pyplot (matplotlib.pyplot) is a module that provides a MATLAB-like state-based interface for matplotlib, making it easy to create plots.
pyplot (matplotlib.pyplot) is a module that provides a MATLAB-like state-based interface for matplotlib, making it easy to create plots.
What does plt.xticks() function do?
- A. Creates tick marks on the y-axis
- B. Sets or gets the tick locations on the x-axis
- C. Rotates the x-axis label
- D. Adds a legend to the plot
Answer: B. Sets or gets the tick locations on the x-axis
plt.xticks() is used to get or set the locations and labels of the tick marks on the x-axis for better readability.
plt.xticks() is used to get or set the locations and labels of the tick marks on the x-axis for better readability.
What does plt.figsize=(10,6) do when creating a figure?
- A. Sets the number of subplots
- B. Sets the width and height of the figure in inches
- C. Sets the resolution of the plot
- D. Sets the font size of labels
Answer: B. Sets the width and height of the figure in inches
plt.figsize=(10,6) specifies the figure dimensions as width=10 inches and height=6 inches, allowing customization of plot size.
plt.figsize=(10,6) specifies the figure dimensions as width=10 inches and height=6 inches, allowing customization of plot size.
Which statement is true about the linestyle parameter in plt.plot()?
- A. It can only be set to 'solid'
- B. It controls the thickness of the line only
- C. It can be set to values like '-', '--', '-.', ':' for different line styles
- D. It is mandatory and must be specified in every plot
Answer: C. It can be set to values like '-', '--', '-.', ':' for different line styles
The linestyle parameter allows customization with '-' (solid), '--' (dashed), '-.' (dash-dot), and ':' (dotted) patterns.
The linestyle parameter allows customization with '-' (solid), '--' (dashed), '-.' (dash-dot), and ':' (dotted) patterns.