Class 12 Informatics Practices Data Visualization using Python Matplotlib MCQ’s Set 3

Plotting in Python using Matplotlib

Purpose of plotting, drawing and saving of plots using Matplotlib (line plot, bar graph, histogram). Customizing plots:- adding label, title, and legend in plots.


Data Visualization in Python – Multiple Choice Questions



Multiple Choice Questions – Set 3


41. Identify the correct statement to invoke plot() function, for making a line chart. import matplotlib.pyplot as plt #assume import statement is written.

a. plt.plot()

b. plot( [1,2,3], [2,5,4])

c. plt.plot( [1,3,4], [2,5,4])

d. None of these

Answer: c. plt.plot( [1,3,4], [2,5,4])

42. Write a statement, to change the size of your plot to 18 units wide and 10 units long. [ import matplotlib.pyplot as plt #assume import statement is written ]

a. plt.figure(18,10)

b. plt.figure( figsize = (18, 10))

c. plt.figure(figsize = (10,18))

d. None of these

Answer: b. plt.figure( figsize = (18, 10))

43. Write a statement, to show a grid on the plot. [ import matplotlib.pyplot as plt #assume import statement is written ]

a. plt.grid( )

b. plt.grid(True)

c. grid(True)

d. None of these

Answer: b. plt.grid(True)

44. Write a statement, to change the color of a line to blue in a line chart.

import matplotlib.pyplot as plt

x = [2, 3.5, 1, 4]

y = [10, 12, 15, 9]

a. plt.plot(x, y, colour=’blue’ )

b. plt.plot(x, y, color = ‘b’)

c. plt.plot(x, y, ‘b’)

d. None of these

Answer: c. plt.plot(x, y, ‘b’)

45. Write a statement, to change the width of line to 5 in a line chart.

import matplotlib.pyplot as plt

x = [2, 3.5, 1, 4]

y = [10, 12, 15, 9]

a. plt.plot(x, y, ‘blue’, linewidth = 5 )

b. plt.plot(x, y, color = ‘b’, linewidth = 5)

c. plt.plot(x, y, ‘b’, width = 5)

d. None of these

Answer: a. plt.plot(x, y, ‘blue’, linewidth = 5 )

46. Which is the not valid line style?

a. solid ‘-‘

b. dashed ‘–‘

c. dotdash ‘.-‘

d. dotted ‘:’

Answer: c. dotdash ‘.-‘

dashdot ‘-.’ is the valid type.

47. Write a statement, to change the dotted line style of a line in line chart.

import matplotlib.pyplot as plt

x = [2, 3.5, 1, 4]

y = [10, 12, 15, 9]

a. plt.plot(x, y, ‘blue’, width = 5, linestyle=’-‘ )

b. plt.plot(x, y, color = ‘b’, linewidth = 5, ls= ‘-‘)

c. plt.plot(x, y, ‘b’, linewidth = 5, ls = ‘:’)

d. None of these

Answer: c. plt.plot(x, y, ‘b’, linewidth = 5, ls = ‘:’)

48. Can you change the marker type, size and its color in line chart?

a. Yes

b. No

Answer: a. Yes

49. Which argument of plot( ) function is use to change the marker type?

a. markertype

b. marker

c. markersize

d. None of these

Answer: b. marker

50. Which argument of plot( ) function is use to change the marker size?

a. size

b. markerwidth

c. markersize

d. None of these

Answer: c. markersize

51. Which argument of plot( ) function is use to change the color of marker boundary i.e. edge?

a. markeredgecolor

b. markeredge

c. edgecolor

d. None of these

Answer: a. markeredgecolor

52. What is the default type of marker in line chart?

a. line type

b. circle marker

c. pointmarker

d. None of these

Answer: a. linetype

53. If you do not specify the marker type, then data points will _________ on the line chart.

a. marked

b. not marked

c. None of these

Answer: a. marked

54. What is the default type of marker in line chart?

a. line type

b. circle marker

c. pointmarker

d. None of these

Answer: a. line type, similar to line width and type.

55. Write a statement, to change the marker type to diamond, marker size to 5 and marker edge color to green of a line chart.

import matplotlib.pyplot as plt

x = [2, 3.5, 1, 4]

y = [10, 12, 15, 9]

a. plt.plot(x, y, marker = ‘D’, size=5, markeredgecolor = ‘g’ )

b. plt.plot(x, y, marker = ‘D’, markersize = 5, markeredgecolor = ‘g’)

c. plt.plot(x, y, ‘b’, markertype = ‘D’, markersize = 5, markeredgecolor = ‘g’)

d. None of these

Answer: b. plt.plot(x, y, marker = ‘D’, markersize = 5, markeredgecolor = ‘g’)

56. Can we combine the marker type and marker color together in line chart?

a. Yes

b. No

Answer: a. Yes

57. Which argument of plot( ) function is used to specify the marker color separately.

a. markercolor

b. color

c. markeredgecolor

d. None of these

Answer: c. markeredgecolor

58. plt.plot(x, y, ‘kh‘ linestyle = ‘solid’)

In the above statement, what is ‘k’ ?

a. marker type

b. line color

c. line width

d. None of these

Answer: b. line color

59. plt.plot(x, y, ‘kh‘ linestyle = ‘solid’)

In the above statement, what is ‘h’ ?

a. marker type

b. line color

c. line width

d. None of these

Answer: a. marker type

60. plt.plot(x, y, ‘kh‘ linestyle = ‘solid’)

In the above statement, ‘k’ stands for which color ?

a. black

b. cyan

c. white

d. None of these

Answer: a. black



Class 12 Informatics Practices : Data Visualization – Plotting in Python MCQ’s


Class 12 Informatics Practices – Data Handling Using Pandas – I Multiple Choice Questions



Class 12 Informatics Practices Societal Impacts Multiple Choice Questions



Class 12 Informatics Practices : NCERT Exercise Solutions


You cannot copy content of this page

Table of Contents
Scroll to Top