Chapter-3 (Data Visualization)
Chapter-3 (Data Visualization)
3. Which of the following statement limits both x and y axes to the Application
interval [0, 7]?
1. plt.xlim(0, 7)
2. plt.ylim(0, 7)
3. plt.xylim(0, 7)
4. plt.axis( [0, 7, 0, 7])
4. A ----- graph is a type of chart which displays information as a Knowledge
series of data points connected by straight line segment.
1. line
2. bar
3. pie
4. boxplot
5. The ----- argument of hist() is set to create a horizontal Application
histogram.
1. landscape
2. portrait
3. documentation
4. orientation
6. What are bins in histogram – Knowledge
1. Non overlapping intervals
2. Overlapping intervals.
3. Set of intervals.
4. None.
7. Which of the following is not a line style for the line of plot chart? Knowledge
1. solid
2. dot-dash
3. dotted
4. dashed
8. Which of the following is the correct way to install matplotlib? Application
1. pip matplotlib install
2. install matplotlib
3. matplotlib install
4. pip install matplotlib
9. Which of the following statements helps to create histograms:- Creation
1.plt.hist
2.plt.hist()
3.hist()
4.matplotlib.pyplot.hist()
10. Which of the following is not histtype while creating histograms:- Creation
1)bar
2)barstacked
3)step
4)barfilled
11. How many type of orientation is there in histograms:- Knowledge
1)horizontal
2)vertical
3)both 1 and 2
4)only horizontal
12. What is the default width of a bar in units in barcharts:- Knowledge
1)0.3
2) 0.5
3)0.8
4)0.4
13. Which of the following is not a linestyle in a line chart:- Knowledge
1)solid
2)dashed
3)dashdot
4)arrow
14. Which of the following statement is used to create line chart:- Creation
1)plt.line
2)plt.line()
3)plt.plot()
4)plt.plot
15. Which one of following is not a valid markertype in line chart knowledge
1)’+’
2)’0’
3)’4’
4)’!’
16. Which of the following function will produce a horizontal bar chart? Application
1). plot()
2). bar()
3) plotbar()
4). barh()
17. To specify the style of line as dashed, which argument of plot() need Application
to be set?
1). line
2). width
3). style
4). linestyle
18. The ---- argument of legend() provides the location of legends. application
1). loc
2). Toc
3). Goc
4). None of these
19. Using pyplot matplotlib, ________ can be used to count how many Knowledge
values fall into each interval.
1). Histogram
2). Pyplot
3). Barchart
4). Pie chart
20. Which of the following one indicates discontinuity? Knowledge
1). histogram
2). pie
3). bar graph
4). None of these
21. Choose the name of function that will return top 5 rows of a dataframe
(i) top(5)
(ii)head()
(iii) head5()
(iv) tail(n-5)
22. Choose the name of function that will return last 5 rows of a
dataframe
(i) bottom(5)
(ii)tail()
(iii) last5()
(iv) tail5()
23. Which function should be called with an object DF of a DataFrame to
get first n rows of a dataframe .
(i) head(n)
(ii) get(n)
(iii) print(n)
(iv) top(n)
24. which function should be called to get last n rows of a dataframe ,DF
(i) DF.tail(n)
(ii) DF.bottom(n)
(iii) DF.last(n)
(iv) DF. print(n)
25. Consider below given dataframe ,Df:
if dataframe is :
(i) df (a,d)
(ii) df[[‘a’,’d’]]
(iii)df[‘a’ , ‘d’]
(iv)df[‘a’:’d’]
What will be python statement to check if value for row 1 and column
b is equal to 4 or not:
(i) df.loc[1,'b']==4
(ii) df.loc[1:'b']==4
(iii)df.loc[[1,'b']]==3
(iv) df[1][‘b’]==4
33. Consider the following dataframe :
64. What is the least no. of arguments required to call plot( ) ? Evaluation
A. 1
B. 2
C. 3
D. None of these
68. Identify the correct parameters for plotting the following line plot: Evaluation
A p.plot([1,2,6],[4,7,8],marker='o',markersize=20,color='y',
markeredgecolor='r', linestyle='--', linewidth=10)
B p.plot([1,2,6],[4,7,8],marker='D',markersize=20,color='y',
markeredgecolor='r', linestyle='-.', linewidth=10)
C p.plot([1,2,6],[4,7,8],marker='Circle',markersize=20,color='y
markeredgecolor='r', linestyle='--', linewidth=10)
D p.plot([1,2,6],[4,7,8],marker='o',markersize=20,color='y',
markeredgecolor='r' , linewidth=10)
69. Identify the correct linestyle used in the following line plot:
A. Linestyle= ‘None”
B. linstyle= “ “
C. linestyle= ‘None’
D. linestyle=None
70. In the following line of code, identify the parameters and their related Knowledge
value:
plot(x, y, 'go--', linewidth=2, markersize=12)
71. For a bar graph, what is default width of each bar ? Analysis
A. 0.5
B. 0.25
C. 0.3
D. 0.8
72. For a bar chart containing 5 bars, and color=[‘r’, ‘g’ , ‘y’], what will Creation
be the colours of the bars:
A. red, green, yellow, yellow, green
B. red, green, yellow, green, red
C. red, green, yellow, red, green
D. Error
73. For a bar chart containing 5 bars, and width=[0.25,0.5] is mentioned. Analysis
What will the width of the bars ?
A. 0.25, 0.5, 0.25, 0.5, 0.25
B. 0.25, 0.25, 0.25, 0.5, 0.5
C. Cannot be determined
D. Error
74. Where does legend appears in a plot when ‘loc’ is not mentioned ? Knowledge
A. Determined by Interpreter
B. Upper left
C. Upper right
D. Lower right
75. Which of the following is best suited for compare things between Understandin
different groups or to track changes over time ? g
A. Line chart
B. Pie chart
C. Bar graph
D. Histogram
77. Identify the correct histtype for the following bar graph Knowledge
A. bar
B. barstacked
C. stepfilled
D. step
79. Which option can be used for accumulating the previous height of the Application
bar ?
A. Cumulative=false
B. cumulative= ‘true’
C. cumulative=True
D. None of these
80. For the following line of code, how many ‘bins’ will be created? Analysis
matplotlib.pyplot.hist(a, bins=[1,5,10,15])
A. 4
B. 3
C. Depends upon the data
D. Cannot be determined
(i) table
(ii) charts
(iii) maps
(iv) infographics
83. Which of the following commands is used to install matplotlib for
coding?
(i) show()
(ii) display()
(iii) execute()
(iv) plot()
85. Which function is used to create a histogram ?
(i) histo()
(ii) histogram()
(iii) hist()
(iv) histtype
86. Which function is used to show legends ?
(i) display()
(ii) show()
(iii) legend()
(iv) legends()
87. The datapoints plotted on a graph are called _____.
(i) points
(ii) pointers
(iii) marks
(iv) markers
88. The plot which tells the trend between two graphed variables is the
_____ graph/chart.
(i) line
(ii) scatter
(iii) bar
(iv) pie
89. Which of the following functions is used to create a line chart?
(i) line()
(ii) plot()
(iii) chart()
(iv) plotline()
90. Which of the following function will create a horizontal bar chart ?
(i) plot()
(ii) bar()
(iii) plotbar()
(iv) barh()
91. Which of the following is not a valid chart type ?
(i) histogram
(ii) statistical
(iii) pie
(iv) bar
92. A _____ is a summarisation tool for discrete or continuous data.
(i) quartile
(ii) histogram
(iii) mean
(iv) median
93. To specify the style of line as dashed, which argument of plot() needs
to be set ?
(i) line
(ii) width
(iii) style
(iv) linestyle
94. Which function would you use to set the limits for x-axis of the plot ?
(i) limits()
(ii) xlimits()
(iii) xlim()
(iv) lim()
95. Which of the following statements is used to create a histogram of
'step' type with 20 bins?
(i) data
(ii) label
(iii) name
(iv) sequence
97. Observe the output figure. Identify the coding for obtaining this
output.
(i)
import matplotlib.pyplot as plt
plt.plot([1,2,3],[4,5,1])
plt.show()
(ii)
import matplotlib.pyplot as plt
plt.plot([1,2],[4,5])
plt.show()
(iii)
import matplotlib.pyplot as plt
plt.plot([2,3],[5,1])
plt.show()
(iv)
import matplotlib.pyplot as plt
plt.plot([1,3],[4,1])
plt.show()
x = [5,2,7]
y = [2,16,4]
plt.plot(x,y)
plt.title('Info')
plt.ylabel('Y axis')
plt.xlabel('X axis')
plt.show()
(i)
(ii)
(iii)
(iv)
99. Which of the following is not a valid plotting function of pyplot?
(i) bar()
(ii) barh()
(iii) hist()
(iv) histh()
100. Which of the following is not a visualization under matplotlib?
ANSWER
Question Answer
No
1. 4)All of above
2. 1)Bar chart
3. 3)plt.xylim(0, 7)
4. 1)line
5. 4)orientation
9. 1)plt.hist
10. 4)barfilled
12. 3)0.8
13. 4)arrow
14. 3)plt.plot()
15. 4)’!’
21. (ii)head()
25. (iv)
a b d
0 1 2 10
1 2 3 24
26. (iv)
a b d
0 1 2 10
1 2 3 24
27. (ii)df[[‘a’,’d’]]
28. (iii) both i and ii
33. (i)
a2
d 24
34. (i)True aparna
True sudhir
35. (i)df[['name','degree']][df.score>90]
39. (iii) 5
41. Answer:- A
42. Answer:- A
43. Answer:- C
44. Answer:- B
45. Answer:- B
46. Answer:- A
47. Answer:- C
48. Answer:- D
49. Answer:- A
50. Answer:- B
51. Answer:- B
52. Answer:- A
53. Answer:- A
54. Answer:- A
55. Answer:- B
56. Answer:- C
57. Answer:- C
58. Answer:- B
59. Answer:- C
60. Answer:- C
61. B
62. A
63. C
64. A
65. A
66. C
67. B
68. A
69. C
70. C
71. D
72. C
73. D
74. A
75. C
76. B
77. D
78. D
79. C
80. B
97. (i)
import matplotlib.pyplot as plt
plt.plot([1,2,3],[4,5,1])
plt.show()
98. (iii)
Region- Kolkata
E-mail ID – soumalikroy@gmail.com
Name of the Chapter- Data Visualization
a. both (A) and (R) are true, and (R) is the correct explanation of (A)
b. both (A) and (R) are true, but (R) is not correct explanation of (A)
c. (A) is true but (R) is false.
d. (A) is false but (R) is true.
a. both (A) and (R) are true, and (R) is the correct explanation of (A)
b. both (A) and (R) are true, but (R) is not correct explanation of (A)
c. (A) is true but (R) is false.
d. (A) is false but (R) is true.
4. Assertion(A): The xticks() function is used to specify ticks for x-axis. Application
Reason(R): To save a plot, savefig() function is used.
a. both (A) and (R) are true, and (R) is the correct explanation of (A)
b. both (A) and (R) are true, but (R) is not correct explanation of (A)
c. (A) is true but (R) is false.
d. (A) is false but (R) is true.
5. Assertion(A): Data visualization demand much more from a Understanding
graph/plot. The graph/plot should have a proper title, X and Y limits
defined, Labels, Legends etc.
Reason(R): Any graph or chart that you create using matplotlib’s
pyplot interface is created as per a specific structure of a plot or shall
we say a specific anatomy.
a. both (A) and (R) are true, and (R) is the correct explanation of (A)
b. both (A) and (R) are true, but (R) is not correct explanation of (A)
c. (A) is true but (R) is false.
d. (A) is false but (R) is true.
6. A: df.head(3) will return top 3 rows of the dataframe
R: head() functions returns rows from the top of dataframe.
(i) A and R both are true and R is correct explanation of A
(ii) A is true but R is False
(iii) A if False but R is true
(iv) both are false
7. A: dataframe , df
df.loc[1,’a’:’d’]
will return the output :
a b d
1 2 3 24
(A) Both Assertion and reason are true and reason is correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not the
correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
10. Question Analysis,
Assertion: PyPlot is a collection of methods within matplotlib
library.
Reason: PyPlot can be used to construct 2D plots easily and
interactively.
(A) Both Assertion and reason are true and reason is correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not the
correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
11. Question Analysis,
Assertion: Python supports data visualization.
Reason: Python provide matplotlib library.
(A) Both Assertion and reason are true and reason is correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not the
correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
12. Question Analysis,
Assertion: A histogram is a summarization tool for discrete data
Reason: A histogram is a summarization tool for continuous
data
(A) Both Assertion and reason are true and reason is correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not the
correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
13. Question Analysis,
Assertion: A frequency polygon is not a type of frequency
distribution graph.
Reason: In a frequency polygon, the number of observations is
marked with a single point at the midpoint of an interval.
(A) Both Assertion and reason are true and reason is correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not the
correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
14. Assertion : Default width of bar graph is 0.8 Understanding
Reason : Line width can be changed.
(A) Both Assertion and reason are true and reason is correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not the
correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
15. Assertion : Title appears on the bottom of the graph. Knowledge
Reason : title() function is used to set the title.
(A) Both Assertion and reason are true and reason is correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not the
correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
16. Assertion: p.plot(x,y,linestyle='.-') will give error. Knowledge
Reason: linestyle parameter is used to set the line style.
(A) Both Assertion and reason are true and reason is correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not the
correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
17. Assertion: We can change the colour of the line plot. Application
Reason: color attribute sets the line colour.
(A) Both Assertion and reason are true and reason is correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not the
correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
18. Assertion: markeredgecolor changes the colour of the line plot. Understanding
Reason: marker are the data points.
(A) Both Assertion and reason are true and reason is correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not the
correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
19. Assertion (A) :Data visualization refers to the graphical
representation of information and data using visual elements
like charts, graphs and maps etc.
ANSWER
Question No Answer
1. b
2. b
3. c
4. b
5. b
6. (i)
7. (iii)
8. (i)
9. Answer:- B
10. Answer:- B
11. Answer:- A
12. Answer:- B
13. Answer:- D
14. A
15. D
16. B
17. A
18. D
19. A
20. C
21. A
22. B
23. A
Name of the vetter- Soumalik Roy
Region- Kolkata
E-mail ID – soumalikroy@gmail.com
Name of the Chapter- Data Visualization
import__________________________ #Statement 1
Games=["PubG","Crush candy","solitaire","minesweeper","sniper"]
Rating=[4.2,4.8,5.0,3.8,4.1]
plt.______________(Games,Rating) #Statement 2
plt.xlabel("Games")
plt.______________("Rating") #Statement 3
plt._______________ #Statement 4
2. Identify the name of the function that should be used in statement 2 to plot the above
graph.
i.line()
ii. bar()
iii. hist()
iv. barh()
4. If the width of all bars need to be changed with specified width 0.5 then, what change
will be there in statement 2
1)plt.width=0.5
2)width=0.5
3)width=[0.5]
4)wid=0.5
5. In case Deepak wants to change the above plot to a horizontal bar chart, which
statement, should he change.
i. Statement 1
ii. Statement 2
iii. Statement 3
iv. Statement 4
2. Sangeeta is trying to see the frequency distribution for 250 people whose height in cms Applicatio
lie between different ranges .Help her to create a histogram that plots an ndarray x, in n
stepfilled horizontal style. She has written the following code:-
import matplotlib.pyplot as plt #1
import numpy as np
x = np.random.normal(170, 10, 250) #2
plt.hist([x],histtype='stepfilled') #3
plt._____________ ("height") #4
plt.ylabel("no of people") #5
plt.___________ #6
1.What will be the first statement in a program to use the feature of pyplot
1)matplotlib
2)matplotlib.pyplot
3)pyplot
4)py.matplotlib
2)What will be the change in statement 3 to create the above histogram as given below:-
1) histtype=’stepfilled’
2) histtype=’barfilled’
3) histtype=’edgefilled’
4) histtype=’step’
3)What will be the command to change the color as red for the histogram:-
1)color=’red’
2)edgecolor=’red’
3)facecolor=’red’
4)color=’r’
4) What will be the change in statement 3 if following change in the shape of histogram is
required:-
1)landscape
2)horizontal
3)vertical
4)orientation=’horizontal’
3. Ram want to get a visual display after doing some analysis on a given set of data ,help Applicatio
him to perform his task.If he has the following dataset n
india=[100,150,145,125,138,160,170]
Australia=[120,130,140,150,110,149,150]
Year=[2010,2012,2014,2016,2018,2020,2022]
He wants to represents above given dataset in such a way he want to see year wise the
value of runs scored by both Indian and Australian team.
1. To get visual display in the form of line which function he should choose in statement1
and 2
1)plt.line()
2)plt.bar()
3)plt.plot()
4)plt.hist()
2.To represent india score in blue which argument should he use in statement 1
1)disp=’blue’
2)dispcolor=’b’
3)color=’b’
4)show=’b’
3.To give a title to the visual display title as “runs scored in test match”
1)plt.heading()
2)plt.header()
3)plt.title()
4)plt.head()
4.To set the marker as shown in following chart what change should be done by him in
statement 1 and 2.
1)marker=’o’ and marker=’+’
2) marker=’o’ and marker=’+’
3)pointer =’o’ and marker=’+’
# dictionary of lists
dict = {'name':["aparna", "pankaj", "sudhir", "Geeku"],
'degree': ["MBA", "BCA", "M.Tech", "MBA"],
'score':[90, 40, 80, 98]}
1.Ram wants to add a new record to this dataframe with index 5 and values
[‘Rahul’,’MCA’,98].What command should he write for the same:
(i) df.loc[5]=[‘Rahul’,’MCA’,98]
(ii) df.loc[5,:]=[‘Rahul’,’MCA’,98]
(iii) df[5]= [‘Rahul’,’MCA’,98]
(iV) None of the above
2.Ram required to display name and degree of first 5 rows. What command should he use
:
(i) df.head().loc[:,'name':'degree']
(ii)df.head()
(iii)df.head()['name','degree']
(iv)df.head()
3.Ram wants to display last 3 rows of the dataframe , and he wrote following command:
df.tail()
He is getting wrong output .What mistake is he doing:
(i)he should write df.tail(3)
(ii) he should write df.tail()
(iii) he should write df.tail3()
(iv) he should write df.tail()==3
4.Ram wants to display rows 2 to 4 and columns name and score only , he confused how
to write code for same. Help him in writing the code by choosing the correct answer:
(i) df.loc[2:4,['name','score']]
(ii) df.loc[2:4,'name':'score']
(iii)df.loc[2:4,'name','score']
(iv)df[2:4,['name','score']]
5. Read the passage given below and answer the following questions. Applicati
TSS school celebrated volunteering week where each section of class XI dedicated a day on
for collecting amount for charity being supported by school. Section A volunteered on
Monday, B on Tuesday, C on Wednesday and so on. There are six sections in class XI.
Amount collected by section A to F are 8000,12000,9800,11200,15500,7300
1)Create a bar chart showing collection amount
2)Plot the collected amount vs days using a bar chart
3)Plot the collected amount vs sections using a bar chart
6. Knowled
ge
(i) Which statement should be written in statement 1to import the appropriate module :
(a) Matplotlib.pyplot
(b) matplotlib.pyplot
(c) pyplot
(d) matplotlib
(ii) Which statement should come in statement 2 for appropriate label which appears in
the legend ?
(a) Sin(x)
(b) Cos(x)
(c) ‘sin(x)’
7. Understa
nding
8.
Ms. Ankita wants to plot the below given graph of y=x*2 vs y=x*3 for x in the range 1 to Knowled
ge
10. However, she is facing some problems. Help her by answering a few questions
related to the code written by her.
(i) What color code should be used to assign black color to the plot of y=x*2 in
the line marked as statement 1?
(a) bl (b) c (c) bk (d) k
(ii) What x axis should be chosen for y=x*3 plot in statement 2 so that the bars do
not overlap.
(a) x (b) 0.4 (c) x+0.4 (d) x*0.4
(iii) Fill in the blank in statement 3 to print all the points on the x axis.
(a) xticks (b) xtick (c) xlabel (d) xlabels
(iv) Fill in the blank in statement 4 to display the legends as shown in the plot.
(a) legends (b) displaylegends (c) displaylegend
(d) legend
9. Mr. Sharma is working in a game development industry and he was comparing the given
chart on the basis of the rating of the various games available on the play store.
He is trying to write a code to plot the graph. Help Mr. Sharma to fill in the blanks of the
code and get the desired output.
import______________ #Statement 1
Games = [ "Subway Surfer", "Temple Run", "Candy Crush", "Bottle Shot",
"Runner
Best" ]
Rating = [4.2, 4.8, 5.0, 3.8, 4.1]
plt._____(Games, Rating) #Statement 2
plt.xlabel("Games")
plt.________("Rating") #Statement 3
plt.________ #Statement 4
1.Choose the right code from the following for statement 1.
(i) matplotlib as plt
(ii) pyplot as plt
(iii)matplotlib.pyplot as plt
(iv) matplotlib.plt as pyplot
2.Identify the name of the function that should be used in statement 2 to plot the above
graph.
1. line()
2. bar()
3. hist()
4. barh()
4.Choose the right function/method from the following for the statement 4.
i. display()
ii. print()
iii. bar()
iv. show()
5.In case Mr. Sharma wants to change the above plot to the any other shape, which
statement, should he change.
i. Statement 1
ii. Statement 2
iii. Statement 3
iv. Statement 4
10.
Gaurav has written a Python Code to create a bar plot as given below using the following
data :
import ______ as ______ #Statement 1
City = [ 'Delhi', 'Beijing', 'Washington', 'Tokyo', 'Moscow' ]
Gender = [ 'Male', 'Female' ]
Happiness_Index_Male = [ 60, 40, 70, 65, 85 ] Happiness_Index_Female = [ 30, 60, 70,
55, 75 ]
plt.bar ( [ 0.25, 1.25, 2.25, 3.25, 4.25 ],
Happiness_Index_Male,
color = 'blue',
label = " Male",
width = 0.5 )
plt._____ ( [ 0.75, 1.75, 2.75, 3.75, 4.75 ],
Happiness_Index_Female,
color = 'Green',
width = 0.5,
label = "Female" ) #Statement 2
pos = range ( len ( City ) )
print ( pos )
plt.xticks ( pos, City, fontsize = 10 )
plt.xlabel ( 'City', fontsize = 16 )
plt.ylabel ( 'Happiness_Index', fontsize = 16 )
_______ # Statement 3
_______ # Statement 4
_______ # Statement 5
1.Identify the suitable code to be used in the blank space in line marked as Statement 1.
a. matplotlib as plt
b. numpy as np
c. pandas as pd
d. matplotlib.pyplot as plt
2.What is the name of the function to plot the required bar graph in the line marked as
Statement 2.
a. hist()
b. pie()
c. bar()
d. scatter()
3.Fill in the blank in statement 3 to set Chart Title as “Happiness Index across cities by
gender “and font size as 18.
a. plt.xtitle("Happiness Index across cities by gender",fontsize = 18)
b. plt.title("Happiness Index across cities by gender",fontsize = 18)
c. plt.ytitle("Happiness Index across cities by gender",fontsize = 18)
d. plt.show("Happiness Index across cities by gender",fontsize = 18)
4.Identify the suitable code for line marked as Statement 4 to display the legends as
shown in the plot.
a. plt.showlegend()
b. plt.legend()
c. plt.display()
d. plt.show()
1.Which of the above statement is responsible for plotting the values on canvas.
a) Statement 8
b) Statement 4
c) Statement 1
d) None of the above
2.Statements 5 & 6 are used to give names to x-axis and y-axis as shown in figure.
Which of the following can fill those two gaps?
a) plt.display()
b) plt.show()
c) matplotlib.pyplot.show()
d) Both b & c
a) zero
b) three
c) Infinite
d) One
5.Which of the following methods will result in displaying 'My first graph!' in the above
graph
a) legend()
b) label()
c) title()
d) Both a & c
ANSWER
CBQ NO Answer
1. 1) 3. matplotlib.pyplot as plt
2) 2. bar()
3) 3. ylabel("Rating”)
4) 2. Width=0.5
5) 2. Statement 2
6) 2. show()
2. 1) 2.matplotlib.pyplot
2) 4.histtype=’step’
3) 3.facecolor=’red’
4) 4.orientation=’horizontal’
5) 3.xlabel()
6) 1.plt.show()
3. 1)3.plt.plot()
2)3.color=’b’
3)3.plt.title()
4)3.pointer =’o’ and marker=’+’
5)1.plt.show()
4. 1) (ii)
2) (i)
3) (i)
4) (i)
5. 1)
import numpy as np
import matplotlib.pyplot as plt
Col=[8000,12000,9800,11200,15500,7300]
X=np.arange(6)
plt.title(“Volunteering Week Collection”)
plt.bar(X, Col, color=’r’,width=0.25)
plt.show()
2)
import numpy as np
import matplotlib.pyplot as plt
Col=[8000,12000,9800,11200,15500,7300]
X=np.arange(6)
plt.title(“Volunteering Week Collection”)
plt.bar(X, Col, color=’olive’,width=0.25)
plt.xticks(X, [‘Mon’,’Tue’,’Wed’,’Thu’,’Fri’,’Sat’])
plt.xlabel(“Days”)
plt.ylabel(“Collection”)
plt.show()
3)
import numpy as np
import matplotlib.pyplot as plt
Col=[8000,12000,9800,11200,15500,7300]
X=np.arange(6)
plt.title(“Volunteering Week Collection”)
plt.bar(X, Col, color=’olive’,width=0.25)
plt.xticks(X, [‘A’,’B’,’C’,’D’,’E’,’F’])
plt.xlabel(“Sections”)
plt.ylabel(“Collection”)
plt.show()
6. (i) B
(ii) C
(iii) B
(iv) A
(v) B
7. (i) c
(ii) a
(iii) d
(iv) a
(v) b
8. (i) C
(ii) C
(iii) A
(iv) D
(v) B
9. 1.(iii)matplotlib.pyplot as plt
2.ii. bar()
3.iii. ylabel("Rating")
4.(iv) show()
5.ii. Statement 2
10. 1.d. matplotlib.pyplot as plt
2.c. bar()
3.b. plt.title("Happiness Index across cities by gender",fontsize = 18)
4.b. plt.legend()
5.d. plt.show()
11. 1.b) Statement 4
2.a) plt.xlabel('x - axis') plt.ylabel('y - axis')
3.d) Both b & c
4.b) three
5.c) title()
Region- Kolkata
E-mail ID – soumalikroy@gmail.com
Name of the Chapter- Data Visualization
23. A bar chart can be plotted using pyplot library’s barh() Understanding
function(T/F)
24. It is impossible to plot multiple series of values in the Understanding
same bar graph.(T/F)
25. A standard marker of representing a non-number data in Understanding
Python libraries is NaN(T/F)
26. Statement import pyplot.matplotlib is a valid statement Understanding
for working on pyplot functions(T/F)
27. The default shape of pie chart cannot be changed from Understanding
oval(T/F)
28. A line chart can be plotted using pyplot library’s line() Understanding
function(T/F)
29. A line chart can be plotted using pyplot library’s plot() Understanding
function(T/F)
30. A bar chart can be plotted using pyplot library’s bar() Understanding
function(T/F)
31. xlabel( ) is used to display message along the x-axis. Knowledge
ANSWER
Question No Answer
1. True
2. False
3. True
4. True
5. False
6. False
7. False
8. False
9. False
10. False
11. False
12. False
13. false
14. TRUE
15. True
16. Tue
17. False
18. True
19. True
20. True
21. Answer:- T
22. Answer:- T
23. Answer:- T
24. Answer:- F
25. Answer:- T
26. Answer:- F
27. Answer:- F
28. Answer:- F
29. Answer:- T
30. Answer:- T
31. True
32. False
33. False
34. True
35. True
36. True
37. True
38. False
39. True
40. False
41. TRUE
42. TRUE
43. FALSE
Correct answer:
plt.show()
44. TRUE
45. FALSE
Correct answer :
plt.title()
46. FALSE
Correct answer :
continuous ranges
47. TRUE
48. FALSE
Correct answer : plot()
49. TRUE
50. TRUE
Region- Kolkata
E-mail ID – soumalikroy@gmail.com