Loading

Quipoin Menu

Learn • Practice • Grow

python-for-ai / Customizing Plots
mcq
Direction: Choose the correct option

Q1.

How do you change the figure size in Matplotlib?
A. plt.size(8,6)
B. plt.figsize(8,6)
C. plt.set_size(8,6)
D. plt.figure(figsize=(8,6))
Direction: Choose the correct option

Q2.

What function adds a grid to a plot?
A. plt.grid(True)
B. Both A and B
C. plt.show_grid()
D. plt.grid()
Direction: Choose the correct option

Q3.

How do you set the x-axis limits from 0 to 10?
A. Both A and B
B. plt.xlim(0,10)
C. plt.axis('x', [0,10])
D. plt.xlim([0,10])
Direction: Choose the correct option

Q4.

How do you change the line style to dotted?
A. plt.plot(x, y, style='dotted')
B. Both A and B
C. plt.plot(x, y, ':')
D. plt.plot(x, y, linestyle='dotted')
Direction: Choose the correct option

Q5.

What does `plt.xticks(rotation=45)` do?
A. Sets x ticks
B. Rotates x-axis tick labels by 45 degrees
C. None
D. Changes x-axis limits
Direction: Choose the correct option

Q6.

How do you add text annotation at coordinates (x,y)?
A. plt.annotate('text', xy=(x,y))
B. Both A and B
C. plt.label('text', at=(x,y))
D. plt.text(x, y, 'text')
Direction: Choose the correct option

Q7.

What is the purpose of `plt.tight_layout()`?
A. Creates a tight layout
B. None
C. Removes whitespace
D. Adjusts subplot parameters for better spacing
Direction: Choose the correct option

Q8.

How do you change the color of a line plot to green?
A. plt.plot(x, y, c='g')
B. plt.plot(x, y, 'g')
C. Both A and B
D. plt.plot(x, y, color='green')
Direction: Choose the correct option

Q9.

What does `plt.axis('equal')` do?
A. Makes plot square
B. None
C. Sets equal scaling for x and y axes
D. Both A and B
Direction: Choose the correct option

Q10.

How do you remove the top and right spines?
A. plt.gca().spines['top'].set_visible(False)
B. None
C. plt.spine_top(False)
D. Both A and B