[go: up one dir, main page]

0% found this document useful (0 votes)
31 views3 pages

Dataa

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views3 pages

Dataa

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1. The matplotlib Python library developed by John Hunter 23. What will be the output of the follwing code ?

2. Pyplot is amodule in the matplotlib package. From matplotlib import pyplot as plt
3. The matplotlib API is imported using the standard convention X=[4,8,3]
4. The _____ is bounding box with ticks and labels. Ans. Axes Y=[1,6,9]
5. The _____ can be plotted verticall or horizontally. Ans. bar chart plt.plot(X,Y)
6. Histograms are used to show a/an ____________. Ans. Distribution plt.title(‘Details)
7. To add a tittle in a chart, ____________ function is used. Ans. tittle() plt.ylabel(‘Y axis’)
8. A bar graph uses bars to compare data among ________. Ans. different categories. plt.xlabel(‘X axis’)
9. What is Pylab? Ans. Pylab is a package that combine numpy,scipy ad matplotlib into a single namespace. plt.show( )
10. Mr.Sanjay wants to plot a bar graph for the given set of values of subjects on x-axis and number of students who opted 24. Write the output graph of :
for that subject on y-axis. Complete the code to perform the following operation (i) to plot the bar graph in statement 1 import
(ii) to display the graph in statement 2 x = [‘HINDI’, ‘ENGLISH’, ‘SCIENCE’ , ‘SST’] y=[10,20,30,40] ____________ matplotlib.pyplot
# statement 1 ____________# statement 2 Ans. (i) plt.bar(x,y) (iii) plt.show( ) as p
11. How to import matplotlib? Ans. form matplotlib import pyplot as plt. x=[2,3,4,5,6,7]
12. Which of the following is not a valid chart type? a. line b. bar c. histogram d. statistical Ans. d.statistical y=[1,2,3,4,5,6]
13. The command used to show legends is Ans. c.legend() p.plot(x,y)
14. The command used to give a heading to a graph is _________Ans. d.plt.title() p.show()
15. Using Python Matplotlib _________ can be used to count how many values fall into each interval Ans. c. histogram
16. Mr. Harry wants to draw a line chart using a list of elements named LIST. Complete the code to perform the following
operations : (i) To plot a line chart using the given LIST (ii) To give a y-axis label to the line chart named sample number.
import matplotlib.pyplot as PLINE LIST=[10,20,30,40,50,60] ______________ #statement 1 _____________
#statement 2 Ans. (i) PLINE.plot(LIST) (i) PLINE.ylabel(“Sample number”) 25. Write code to plot a line graph showing the relation between channel name and its TRP rating ( 4 channels). Include the
17. In matplotlib, what is ticks? Ans. A standard graph shows the marks on the axis, in matplotlib library, it is called ticks. titles and formatting of your choice. The font size of the x and y labels should be 15 and font color should be green
18. What is the use of label in plotting? Ans. Label is used to add labels or names to respective x and y axis. import matplotlib.pyplot as p
19. _____ are specified as consecutive, non overlapping intervals of a variable, mainly used in histograms. Ans. ii) Bins x=["Sony","Star","SAB","Zee"]
20. Assuming that a line chart is plotted on x and y axis, write the command to give title as ‘New Graph’ using Plt object y=[60,40,55,35]
Ans. Plt.title(‘New Graph’) p.plot(x,y, linestyle=":")
21. Consider the following graph. Write the code to plot it p.title('TRP of various channels')
Ans. import matplotlib.pyplot as plt a = [0,1,2,3,4,5] b = p.xlabel('Name of Channel',fontsize="15",color="green")
[10,31,26,24,20] plt.plot(a,b) plt.show() p.ylabel('TRP',fontsize="15",color="green")
p.show(
26. Consider the following graph. Write a program in python to draw it along with proper labeling of X-axis, Y-axis and
Title for the line Chart of your choice
import numpy as np
import matplotlib.pyplot as plt
x=np.linspace(-2, 2,50)
22. Write code to y=x*x
draw the following bar graph representing the number of students in each plt.plot(x,y)
class. plt.title('Y = x * x')
Ans. import matplotlib.pyplot as plt Classes = ['VII','VIII','IX','X'] plt.xlabel('X-Axis')
Students = [40,45,35,44] plt.barh(classes, students) plt.show() plt.ylabel('Y-Axis')
plt.show()

27. Consider the following graph. Write a program in python


to draw it. (Height of Bars are 10,1,0,33,6,8)
import numpy as np
import matplotlib.pyplot as plt

plt.hist([0,10,20,30,40,50],bins=[0,10,20,30,40,50,60],weights=[10,1,0,33,6,8],edgecolor='yello w') Plt.bar(X, Y)


plt.title('Histogram of Student Data')  Both the sequence X and Y are not of same shape.
plt.xlabel('value') 7. To create a column chart we can use  a. bar()
plt.ylabel('Frequency') 8. To view changes in data over a period of time we can use _______ chart. a. Line
plt.show() 9. Which shape of marker will be printed in the scatter chart made using following code
Plt.scatter(x, y, marker='D')
 b. Diamond
10. Identify the following chart type.
 b. Histogram

1. Box plot is visual representation of statistical ___ summary


of give dataset  five number
2. To import pyplot module we can write  import matplotlib.pyplot and Import mathplitb.pyplot as plt
3. Chat given below is type of

11. Which of the following is not a type of bar chart?


a. Column chart b. Bar chart c. Histogram d. Scatter chart  d. Scatter chart
12. Which of the following is the correct syntax for displaying a title on a chart?
 d. Plt.title("My Title")
13. In histogram, it describes the no of data points that falls within a range of given values  b. bins
14. In the given chart, what is the box surrounded by a red color called?
 b. Chart title.
 Pie chart
4. To create a chart, pyplot provides  plot ()
5. Which of the following type of chart is not valid?
a. Line b. Pie c. Curve d. Bar  c.curve
1. To create a histogram, pyplot provides:  a. hist()
2. Look at the following graph and select the appropriate code to obtain this output. (Please assume that pandas and
matplotlib are already imported.)
medal = ['gold', 'silver', 'bronze']
delhi = [18, 22, 16]
mumbai = [16, 14, 20]
plt.plot(medal, delhi) 15. The best suitable chart to display data trend is  a. Line
plt.plot(medal, mumbai) 16. The difference between histogram and bar chart is (i) Bar chart is used to represent continuous values and histogram
plt.title("Medal Tally") represents discrete values (ii) There is no gap between bars in histogram however in bar chart gap exists.  b. (i)
plt.show() False, (ii) True.
cách khác 17. Which statement is not true about scatter charts?  The closer the dots to line, the weaker the relation will be
df = pd.DataFrame({'Delhi': [18, 22, 16], 'Mumbai': [16, 14, 18. A chart represents the _______ between different elements of data categories  a. Relationship
20]}, index=['gold', 'silver', 'bronze']) 19. Graph which can be plotted vertically or horizontally is  a. Bar
df.plot(kind='line') 20. In the given chart, points surrounded with circle is called?
plt.title("Medal Tally")
plt.show()
3. Which of the following option describes a pie chart? c. Contribution of individual values to a total value
4. In which type of chart, more than one data series can be displayed together?  Line and Bar
5. Which of the following is best suitable chart to represent continuous data?  d. Histogram
6. While executing it, is producing error. Why?
X = range(0, 40, 8)
Y = range(10, 100, 10)
 c. Markers. 34. what the color of the last bar will be given a specific list of colors. plt.bar(cities, population, color = ['r', 'g', 'b', 'm'])
 a. Magenta
35. "Following chart is type of"  Bar Chart.

21. Which of the following does not visualize data?  c.


Shapes
22. To create a column chart we can use  a. Histogram b. Boxplot c. Pie d. All are correct
36. Raj has written the following code to create a bar chart:
23. Which type of chart uses bars to represent data values?
import matplotlib.pyplot as plt
 legend
weekdays = ['sun', 'mon', 'tue']
sale = [1234, 3312, 2541]
plt.bar(weekdays, sale)
when executing this code, Raj is not able to display any chart. The question asks what should be suggested to Raj to
execute the code and display the chart successfully. The options provided are:
 He should add show() function at the end of code
37. The interface of Matplotlib used for data visualization  d. Pyplot
38. The best suitable real-life example of data visualization is  a. Percent of population by age group in India b. Google
Analytics
24. To display histogram with well-defined edge we can write  df.plot(type = 'hist', edgecolor = 'red') 39. Which of the following is correct code to plot a line chart with a dotted linestyle?  plt.plot(x, y, linestyle="dotted")
25. Plot which is used to give a statistical summary is  d. Box plot plt.show()
26. Which of the following is not a parameter of the pyplot.plot() method?  b. Lineheight 40. n the given chart, the box surrounded with a red border is called"  b. X label.
27. To compare data we can use ___ chart"  b. Bar
28. Which of the following chart elements is used to identify data series by its color patterns?  b. Legend
29. identifying a type of chart
a. Scatter Chart

41. Which of the following is the correct syntax to create a histogram with bins specified? a. plt.hist(x, bins=10) b.
plt.hist(x, bins=[10,11,12,13,14]) c. plt.hist(x, bins=range(10,15)) d. All are correct
42. If you install Python IDLE, Matplotlib is installed automatically. a. True b. False
43. The command to install Matplotlib library in python is:  Pip install matplotlib
30. Look at the following graph and select appropriate code to obtain 44. In the given chart, the box surrounded by a red border is called:  Y label
this output. (Please assume that pandas and matplotlib is already imported)"
zone = [1, 2, 3, 4]
schools = [230, 430, 300, 140]
plt.plot(schools, zone)
plt.title("School Survey")
plt.show()
31. which of the given statements is incorrect regarding data
visualization.  Visualizing large and complex data does not produce
effective results
32. Matplotlib is ____ plotting library  b. 2D 45. Select the correct statement to display a horizontal box plot:  plt.boxplot(data, vert=False)
33. Data __________ refers to graphical representation of data.  Visualization 46. The value of _______ chart is calculated in terms of percentage.  d. Pie

47. By default, Plot() function plots a  Line chart import pandas as pd


48. Which of the following options describes a column chart?  Comparison in different categories of data import matplotlib.pyplot as plt
49. Which of the following is not a method to create a chart using pyplot?  d. histg() x = [2, 4, 6, 8]
50. To represent proportionate contribution of individual data we can use _____ chart  c. Pie y = [23, 10, 45, 20]
51. Symbol which represents a single data value (point) in a chart is called  Marker plt.plot(y, x, color='m', linestyle='dashed', marker='+', markersize=10, markeredgecolor='b')
52. Which of the following is the best suitable chart to show data correlation?  Scatter plt.show()
53. Raju wants to create a scatter chart for the given data
X = [1, 2, 3, 4]
Y = [12, 23, 16, 28]
Help him to write the correct code (important libraries are imported)
a. Plt.plot(x, y, 'o')
b. b. Plt.scatter(x, y)
c. Df = pd.DataFrame({'c1': x, 'c2': y})
Df.plot(kind='scatter', x='c1', y='c2')
d. d. a and b both
e. All of the above
54. Pyplot is a  a. Module
55. The default type of histogram is  c. Bar 69. Which of the following is used to set the limit of x-axis of the plot?  d. Xlimits()
56. Which of the following argument cannot used with hist()  a. Bin 70. Argument used in pie() to create wedges out from the pie chart is:  b. Explode
57. By default hist() uses bin value of ____  10 71. Name of diagram is ...  histogram,
58. Which of the following websites provide data freely to download and to do data analysis for educational purposes?
 a. data.gov.in
59. ____ chart displays only one data series at a time.  c. Pie
60. Which of the following data summary is not included in a box plot?  c. Count
61. The diagram is a box plot

62. Box plot can be created by writing command:  b. Plt.boxplot()


72. Name of diagram is ...  Scatter plot
63. Which of the following is a correct statement to save a chart using savefig()?  d. plt.savefig("graph.ppt")
64. If the extension of file name is not given in savefig(), then file is saved with ____ extension.  a. png
65. From the following dataset: 63, 65, 67, 69, 69, 70, 71, 71, 73, 74, 74, 75, 77, 77, 83, 85, 87
c. L = [63, 65, 67, 69, 69, 70, 71, 71, 73, 74, 74, 75, 77, 77, 83, 85, 87]
plt.boxplot(L, vert = False)
plt.show()
66. Select the correct statement:
(i) We can specify width argument containing sequence to specify different width of the bars in bar chart (ii) If
x and y limits for a plot are not set, pyplot automatically sets the limits as per values of dataset
 a. Both are true
67. Write appropriate code for the given chart (important libraries are already included).
73. ________________is the presentation of quantitative information in a graphical form 
a = ['apple', 'banana', 'orange', 'mango', 'pineapple', 'grapes']
Data visualization
b = [120, 340, 200, 150, 60, 300]
74. line chart
plt.pie(b, labels = a, autopct = '%1.1f%%')
plt.show()

68. Predict the output of the given code:


75. Pie chart

85. What is Florida's median?  10

76. Another way of saying one quarter  25%


77. The main heading, which describes the purpose and content of the chart. 
Chart Title
78. An object that explains the symbols, colors, or patterns used to differentiate the data.  Legend
79. A single value or text explanation used to explain the data in a series. 
Data Label
80. Used in a graph to represent values. 
Data Markers
81. A collection of related values, such as one row or one column from a spreadsheet.  Data Series import matplotlib.pyplot as plt
82. Which has a higher median?  Texas
data = {'1990': [52, 64, 78, 94],

'2000': [340, 480, 688, 766],

'2010': [890, 560, 1102, 889]}

df1 = pd.DataFrame(data, index=['a', 'b', 'c',


'd'])

df1.plot(kind = 'bar')

plt.show()

83. Which has a lower median?  Florida


import pandas as pd

import matplotlib.pyplot as plt

data = {'1990': [52, 64, 78, 94],

'2000': [340, 480, 688, 766],

'2010': [890, 560, 1102, 889]}

df1 = pd.DataFrame(data, index=['a', 'b', 'c', 'd'])

plt.scatter(df1['1990'], df1['2010'])

84. Which has a lower IQR? (Interquartile Range)  Florida plt.show()

import matplotlib.pyplot as plt

smarks = [10, 40, 30, 60, 55]

sname = ["Sahil", "Deepak", "Anil", "Ravi", "Riti"]

plt.plot(sname, smarks)

plt.xlabel('Student Name')

plt.ylabel('Marks Scored')

plt.title('Marks Secured by Students in Term-1')

plt.show()

import numpy as np

import matplotlib.pyplot as plt

A = np.arange(2, 20, 2)

B = np.log(A)

C = np.log(A) * 1.2

plt.plot(A, B)

plt.plot(A, C)

plt.show()

import matplotlib.pyplot as plt

hobbies = ['Dance', 'Music', 'Painting', 'Playing


Sports']

people_count = [300, 400, 100, 500]

plt.bar(hobbies, people_count)

plt.xlabel('Hobbies')

plt.ylabel('Number of People')

plt.title('Favourite Hobby')

plt.savefig('favourite_hobby_chart.png')

plt.show()

You might also like