Loading

Quipoin Menu

Learn • Practice • Grow

python-for-ai / Line and Bar Charts
mcq
Direction: Choose the correct option

Q1.

Which library is most commonly used for basic plotting in Python?
A. Seaborn
B. Bokeh
C. Matplotlib
D. Plotly
Direction: Choose the correct option

Q2.

How do you create a simple line plot using Matplotlib?
A. plt.bar(x, y)
B. plt.scatter(x, y)
C. plt.line(x, y)
D. plt.plot(x, y)
Direction: Choose the correct option

Q3.

What does `plt.bar(x, y)` produce?
A. A line chart
B. A histogram
C. A scatter plot
D. A bar chart
Direction: Choose the correct option

Q4.

How do you add a title to a plot?
A. plt.set_title('Title')
B. plt.text('Title')
C. plt.title('Title')
D. plt.label('Title')
Direction: Choose the correct option

Q5.

What is the purpose of `plt.xlabel('X')`?
A. Set legend
B. Set title
C. Set label for y-axis
D. Set label for x-axis
Direction: Choose the correct option

Q6.

How do you display a plot in a Jupyter notebook?
A. plt.display()
B. plt.show()
C. Both A and B
D. %matplotlib inline
Direction: Choose the correct option

Q7.

How do you create a horizontal bar chart?
A. plt.hbar(x, y)
B. plt.barh(x, y)
C. plt.bar(x, y, orientation='horizontal')
D. Both A and B
Direction: Choose the correct option

Q8.

What does `plt.legend()` do?
A. Adds a title
B. Adds labels
C. Adds a grid
D. Adds a legend to the plot
Direction: Choose the correct option

Q9.

How do you save a plot to a file?
A. plt.export('plot.png')
B. plt.write('plot.png')
C. plt.save('plot.png')
D. plt.savefig('plot.png')
Direction: Choose the correct option

Q10.

What is the output of `plt.plot(x, y, 'r--')`?
A. Blue dashed line
B. Green dotted line
C. Red solid line
D. Red dashed line