Case Study Based Questions on data visualization
1. Consider the following program and answer any four question
from (i) to (v) : import _______ as plt
[Link]
([2,3,4,8,1],[2,4,7,3,5],
label= _____ )
[Link]( )
[Link](____ )
[Link](‘Height’)
plt._______ (‘Vertical Bar Chart’)
(i) Which Module will be imported in Line 1 for above code ?
(a) matplotlib (b) [Link]
(c) plotlib (d) None of these
Ans: (b)
(ii) Name the label that can be used to represent the bar chart in Line 2 .
(a) Data (b) Data Values
(b) Values for X axix (d) All of these
Ans: (d)
(iii) Which message is best suited for xlabel ?
(a) X values (b) Y values
(c) Legend (d) Vertical
Ans: (a)
(iv) Which method will take place at Line 6 for setting heading on the top of Chart ?
(a) Title()
(b) title()
(c) Head()
(d) All of these.
Ans: (a)
(v) Choose the statement to be place at Line7 of the above code .
(a) [Link]() (b) [Link]()
(c) [Link]() (d) [Link]()
Ans: (b)
2. If you are given to plot a histogram using numpy array as per the code given below then
answer any of four questions from (i) to (v) from matplotlib import _____ as plt
Impot numpy as np fig,
ax = plt.______ (1, 1)
a= [Link]([26,59,44,39,76,16,23,11,18,78])
[Link](a, bins=[0,10,20,30,40])
ax._____ (‘Histogram’)
ax.set_xticks ([0,10,20,30,40, ])
ax.set_xlabel(‘Percentage’)
ax._______ (‘Students’)
______
(i) Choose the correct option to import for given propgram:
(a) matplotlib (b) matplot
(c) pyplot (d) plot
Ans: (c)
(ii) Fill in the blank at Line 3
(a) subplots (b) subplot
(c) plot (d) subplt
Ans: (a)
(iii) Which statement is used to set title in Line 6 ?
(a) title (b) set_title
(c) set (d) Title
Ans: (b) set_title
(iv) How to set Y-axis label ?
(a) label() (b) set_y
(c) set_ylab () (d) set_ylabel
Ans: (d) set_ylabel
(v) To fill in blank on Line 10 for showing histogram what can bee used ?
(a) [Link]() (b) plt_show()
(c) plot_show() (d) [Link]
Ans: [Link]()
3. Consider the following case and answer the from (i) to (v)
import …………. as pd
import matplotlib. _____ as plt data=
{‘Name’ : [‘Karan’, ‘Adi’, ‘Abhinav’,
‘Kirti’, ‘Rahul’ ],
‘Height’ : [60,61,63,65,61],
‘Weight’ : [47,89,52,58,50,47]} df=pd. _________ (data)
df._____ (Kind =’hist’, edgecolor = ‘Green’, linewidth =2,
linestyle=’:’ , fill= False) _____________
(i) Fill in the blank in Line 1.
(a) numpy (b) pandas
(c) Python (d) matplot
Ans: (b) pandas
(ii) Fill in the blank in Line 2.
(a) pyplot (b) plot
(c) pyp (d) None of these
Ans: (a) pyplot
(iii) Which of the following is used in Line 6 to represent the data ?
(a) Series (b) Matplot
(c) DataFrame (d) Plot
Ans: (c) DataFrame
(iv) For blank of Line 7 command used may be :
(a) plt (b) pyplot
(c) plot (d) figure
Ans: (c)plot
(v) To show the above graph , which statement is used in Line 8 ?
(a) [Link] (b) [Link]()
(c) [Link] (d) [Link]()
Ans: (d) [Link]()