CLASS - XII
SAMPLE PAPER (IP )
UNIT TEST PAPER - 2022-23
M.M. 20
Q.1 Create horizontal bar chart: 1
(a) bar()
(b) barh()
(c) plot()
(d) scatter()
Q.2 Which Pyplot module you can create histogram? 1
(a) plot()
(b) bar()
(c) hist()
(d) boxplot()
3.
The plot method on Series and DataFrame is just a simple wrapper around
____________. 1
a) gplt.plot()
b) plt.plot()
c) plt.plotgraph()
d) none of the mentioned
4.
Which of the following plots are often used for checking randomness in time
series? 1
a) Autocausation
b) Autorank
c) Autocorrelation
d) None of the mentioned
Q.5 Write a program to
plot a line chart to depict the changing weekly onion price for four weeks.
Give appropriate axes labels. 3
import matplotlib.pyplot as plt
Week = [1,2,3,4]
Prices = [40, 80, 100, 50
plt.plot(Week, Prices)
plt.xlabel(‘week’)
plt.ylabe(‘Onion price’)
plt.show()
Q.6 Marks is a list that stores marks of a student in 10 unit tests. Write a program to plot the student’s performance in these 10 unit tests. 3
import matplotlib.pyplot as plt
Week=[1,2,3,4,5,6,7,8,9,10]
Marks – [12,10,10,15,17,25,12,22,35,40]
plt.plot(Week, Marks)
plt.xlabel(‘week’)
plt.ylabe(‘Unit Test Marks’)
plt.show()
Q.7 Write a program to
plot a horizontal bar chart from the height of 5 students. 3
import matplotlib.pyplot as plt
Height = [ 5.1, 5.5, 6.0, 5, 6.3]
Names = [‘Arti’, ‘Rama’, ‘Vindo’, ‘Rakesh’, ‘Nisha’]
plt.barh(Names, Height)
plt.xlabel(‘Height’)
plt.ylabel(‘Names’)
plt.show()
Q.8 Write a program to plot a bar chart from the medals won by India. Make sure that the Gold, Silver, Bronze and Total tally is represented through different widths and different colors. 3
Medals |
Gold |
Silver |
Bronze |
Total |
India |
90 |
60 |
60 |
210 |
import matplotlib.pyplot as plt
Medal = [‘Gold’, ‘Silver’, ‘Bronze’, ‘Total’]
India = [90,60,60,210]
plt.bar(Medal, India, width =[0.7, 0.5, 0.3, 1, color
=[‘gold’, ‘silver’, ‘brown’, ‘black’]
plt.xlabel(‘Medel Type’)
plt.ylabel(‘India Medal count’)
plt.show()
Q.9 Create an array A in
the range 1 to 20 with values 1.15 apart. Another array B, contains the log
values of the elements in the array A.
Write a program to create a scatter plot of first vs. Second array (array A vs. B) with red circles markers ; specify the x-axis (containing first array’s values) title as ‘Random Values’ and y-axis title as ‘Logarithm Values. 4
import numpy as np
import matplotlib.pyplot as plt
A = np.arange(1,20, 1.25)
B = np.log(A)
plt.plot(A, B, ‘ro’)
plt.xlabel(‘Random Values’)
plt.ylabe(‘Logarithm Values’)
plt.show()
================================