Half Yearly Examination 2022-23 PT2: Class XII
Half Yearly Examination 2022-23 PT2: Class XII
Half Yearly Examination 2022-23 PT2: Class XII
2. While accessing the column from the dataframe, we can specify the column name. In
case column does not exist, which type of error it will raise?
OR
import pandas as pd
data=pd.DataFrame( )
print(data)
c) Data Visualisation makes complex data more accessible, understandable and usable
7. What is the minimum number of arguments required for plot( ) function in matplotlib?
a) 1 b) 2 c) 3 d) 4
a) matplotlib.pyplot b) matplotlib.pip
c) matplotlib.numpy d) matplotlib.plt
1
12. State true or false
14. Write a code to create a series object using a dictionary that stores the salary of employees
in ABC organisation.
16. Read the statements given below. Identify the right option from the following for attribute and
method/function.
17. Zeenat has created the following data frame dataframel to keep track of data Rollno, Name,
Marks1 and Marks2 for various students of her class where row indexes are taken as the
default values:
1 Swapnil Sharma 30 50
2 Raj Batra 75 45
3 Bhoomi Singh 82 95
4 Jay Gupta 90 95
a) print(max(dataframe1[‘marks1’, ‘Marks2’])
c) print(max(datafrane1[‘Marks1’]) d) print(max(dataframe1[‘Marks2’])
ii) She needs to know the marks scored by Rollno 2. Help her to identify the correct set of
statement(s) from the given options.
2 IP + 2 (PT-2)
c) print(dataframe1[dataframe1. Rollno = = 2])
iii) Which of the following statement(s) will delete the 3rd column?
iv) Which of the following command will display the total number of elements in the dataframe?
a) print(dataframe1.shape) b) print(dataframe1.num)
c) print(dataframe1.size) d) print(dataframe1.elements)
v) Now she wants to add a new column “Marks3” with relevant data. Help her to choose the
command to perform this task.
a) dataframe1.column = [ 45, 52, 90, 95] b) dataframe1 [‘Marks3’] = [ 45, 52, 90, 95]
18. A Gift Gallery has different stores in India. Database Administrator Abhay wants to maintain
database of their Salesmen in SQL to store the data. He has decided that
Attributes of the table Scode - Numeric, Sname - Character 25, Address - Character 25,
Dofjoin-Date, Sales - Numeric and Area - Character 10.
Consider the following records in ‘Salesman’ table and answer the given questions.
Table : Salesman
3 IP + 2 (PT-2)
i) State the command that will give the output as
Sname
Sushant
Priya
ii) Which of the following commands will display the details of all sales record of North Area,
regardless of case (whether North / NORTH / north).
iii) Help Priya to display sname and sales of east and west areas.
a) SELECT Sname, Sales FROM Salesman WHERE Area = “East” AND Area = “West”;
b) SELECT Sname, Sales FROM Salesman WHERE Area = “East” OR Area = “West”;
c) SELECT Sname, Sales FROM Salesman WHERE Area IN “East” AND “West”;
iv) The command to display the name of the salesman along with the sales amount rounded
off to one decimal point will be:
19. Read the statements given below and identify the right option to draw a histogram.
Statement A : To make a histogram with matplotlib, we can use the plt.hist( ) function.
22. Write a Python code to create a DataFrame with appropriate headings from the list given
below:
[‘S101’, ‘Amy’, 70], [‘S102’, ‘Bandhi’, 69], [‘S104’, ‘Cathy’, 75], [‘S105’, ‘Gundaho’, 82] 2
OR
import pandas as pd
data = {‘a’ : pd. Series ([20, 85, 46, 23, 56], index = [1, 2, 3, 4, 5]), ‘b’ : pd. Series ([33, 45, 57,
12, 34, 82, 49], index = [1, 2, 3, 4, 5, 6, 7])}
print (df)
OR
Consider the series object srl that stores the salary of teacher, as shown below. Here Teacher’s
name represents by their initial names.
R 15000
K 12000
N 20000
L 22000
Write the code to modify the salary of K as 18000 and for N and L as 25000. Print the changed
Series.
25. Mention the type of the functions given below with their purpose. 3
26. Draw the approximate graph which display the multiline in same plot. 3
plt.title (‘Multiline’)
plt.legend ( )
plt.show( )
28. Write the code for the following graph which display the different style multiline in same plot.
29. A bat graph is used to show individual figures at a specific time or to compare different items.
Similarly, a bar graph which is showing the marks of different subjects. You have to write the
code that will represent the given graph. 5
30. Write a pandas program to sort the DataFrame first by Name in descending order, then by
‘Score’ in ascending order. 5
Sample DataFrame :
6 IP + 2 (PT-2)
exan_data ={‘Name’, ‘Chirag’, ‘Tarun’,
‘Vanshika’, ‘Kartik’]
‘Qualify’ : [‘Yes’, ‘No’, ‘Yes’, ‘No’, ‘No’, ‘Yes’, ‘Yes’, ‘No’, ‘No’, ‘Yes’]}
labels=[‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘h’, ‘i’, ‘j’]
Write the commands to do the following operations on the DataFrame given above:
i) ‘To add new section SecE with the values [08, ‘Kushal’, 80.0].
7 IP + 2 (PT-2)