Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

HOLY INNOCENTS PUBLIC SCHOOL

MID TERM Examination 2022-23


Subject- IP (065)
Class –XII C
Time: 3 Hrs Max Marks: 70
General Instruction:
(i) This question paper is divided into 3 Section-A,B and C
(ii) Section A, each question content 1 marks.
(iii) Section B, each question content 2 marks.
(iv) Section C, each question content 5 marks.
Section-A
1. Which of the followings statement is wrong? (1)
(a) Can’t change the index of the series
(b) We can easily convert the list tuple , and dictionary into Series
(c) A Series represents a single column in memory
(d) We can create empty series
2. What type of error is returned by the following Statement? (1)
import pandas as pd
pd.Series([1,2,3,4],index=[ a,b,c,d])
a) Value Error
b) Syntax Error
c) Name Error
d) Logical Error
3. The data of any CSV file can be shown in which of the following software? (1)
a) Ms word
b) Notepad
c) SpreadSheet
d) All of these Above
4. Which python library is not used for data Science ? (1)
a) Pandas
b) Numpy
c) Matplotlib
d) Tkinter
5. Which method is used to Delete row(s)from Data Frame ? (1)
a) Drop() method
b) Del() method
c) Remove() method
d) Delete () method
6. Consider following Code: (1)
import numpy as np
import pandas as pd
l=np.array([10.20])
a=pd.Series(____________________)
print(a)
0 1000
1 8000
What is the correct statement for the above output in the following
a) D=L*3
b) Data=L**3
c) L*3
d) [10,20]**3
7. Which library is imported to draw charts in python
(1)
a) CSV
b) Matplotlib
c) Numpy
d) Pandas
8. Which of the following would give the same output as DF/DF1 where DF and DF1 are
Data Frames? (1)
a) DF.div(DF1)
b) DF1.div(DF)
c) Divide (DF,DF1)
d) Div(DF,DF1)
9. Which attributed is not used with DataFrame ? (1)
a) Size
b) Type
c) Empty
d) Columns
10. To Change the which of bars in bar chart, which of the followings arguments with a
Float value is used? (1)
a) hwidth
b) width
c) breath
d) barwidth
11.Identify the correct option to select first four rows and second to fourth columns from
a data Frame (1)
a) Display(Data.loc[1:4,2:4])
b) Display(Data.iloc[1:5,2:5])
c) Print(Data.loc[0:4,1:4])
d) Print(Data.iloc[1:4,2:4])
12.Which of the following commands is used to import matplotlib for coding? (1)
a) import matplotlib.pyplot as plt
b) import plt.matplotlib as plt
c) import py.matplotlb as plt
d) import pyplot.matplotlib as plt
13.Which attribute is used with Series to count the total number of NAN Values. (1)
a) Size
b) Len
c) Count
d) Count total
14.Consider the following Series in python. (1)
Data=pd.Series([5,2,3,7],index=[‘a’,’b’,’c’,’d’])
Which statement will display all odd values
a) Print(data%2==0)
b) Print(data%2!=0)
c) Print(data mod 2=0)
d) Print(data[data%2!=0])
15. Which method is used to delete row(s) from DataFrame? (1)
a) drop() method
b) del() method
c) Remove() method
d) Delete() method
16. Which of the following commands is used to install pandas (1)
a) pip install python-pandas
b) pip install pandas
c) python install python
d) python install pandas
17.A two dimensional labelled array that is an ordered collection of columns to store
heterogeneous data type (1)
a) Series
b) Numpy
c) DataFrame
d) Panel
18. Which attribute of DataFrame is used to perform the transpose operation on a
DataFrame (1)
a) T
b) Ndim
c) Empty
d) Shape
19.Which function is used to find the most often appeared value from a set of numbers?
(1)
a) mean()
b) median()
c) mode()
d)count()
20. Which of the following methods should be employed in the code to display a plot()?
(1)
a) show()
b) display()
c) execute()
d) show()
21. Which function is used to find the average value from a set of numbers (1)
a) mean()
b)mode()
c) sum()
d) count()
Section -B
22. a) What is pandas Series with Example (2)
b) What is Data Frame with Example (2)
23. In pandas S is a Series with the following result (2)
S=pd.Series ([5,10,15,20,25])
The Series object is automatically indexed as 0,1,2,3,4 .Write a statement to assign
the index as a,b,c,d, e explicitly.
24. How can we check if a Data Frame df has any missing values (2)
25. Given two objects, a list object namely lst1 and a Series object namely ser1, both
having similar values, i.e 2,4,6,8. Find out the output produced by the following
statements. (2)
i) print(lst1*2) ii) print(ser1*2)
26. Write a python code to create an empty Data Frame. (2)
27. Name the functions you can use to iterate over Data Frames (2)
28. Write a small python code to create two Data Frames by using the given two list
and appending the second Data Frame to the first. Also provide the
headings (a and b) [[1,2] ,[3,4]] and [[5,6],[7,8]]
(2)
29. Mr.Sanjay want to plot a bar graph for the given set of values of subject on x-axis
And number of students who opted for that subject on y-axis. (4)
i) To plot the bar graph in statement1
ii) To display the graph in statement2
import matplotlib.pyplot as plt
x=[‘Hindi’,’English’,’Science’,’SST’]
y=[10,20,30,40]
__________________________________________Statement 1

__________________________________________Statement2

30. What is the basic difference between iterrows and iteritems (2)
th
31. Write a code statement to list the value of a cell in the 5 row and “item” column
from a dataFrame “Sales” (2)
32. A dictionary Grade contains the following:

Name Grade
Rashmi A1
Harsh A2
Ganesh B1
Priya A1
Vivek B2
Write Statement for the Following (6)
i) Create DataFrame named “GR”
ii) Add a column called marks with followings data:[99,95,92,89,96,82]
iii) Deleted 3rd and 5th row
33. Assume a DataFrame df1 that contains data about climatic conditional of various
citites with c1, c2, c3, c4 and CS as indexed and give the output of question from (i) to (v)
(4)

City MaxTemp Min Temp Rainfall


C1 Delhi 40 32 24.1
C2 Bengaluru 31 25 36.2
C3 Chennai 35 27 40.8
C4 Mumbai 29 21 35.2
C5 Kolkata 39 23 41.8

a) Df1.shape
b) Df1[1:2]
c) Df1.loc[‘c1’:’c3’,city]
d) Df1.iloc[2]
Section –C
34. Create the following data frame named “emp” storing the following details : (5)

ename Design dept salary doj


0 Rinkoo Sharma MNGR ACCTS 80000 2010-10-01
1 Shiv Bansal CLRK ADMI 45000 2012-01-04
N
2 Raman Ahuja CLRK ADMI 35000 2009-03-01
N
3 Aman Sharma SALESMA SALES 55000 2009-01-01
N
4 Seema Singh MNGR SALES 85000 2008-02-01
5 Aman Singh SALESMA SALES 45000 2006-12-12
N
6 Rajat Singh CLRK ACCTS 35000 2009-10-01

Considering the above data frame answer the following by writing appropriate command (set
of commands) in Python Pandas.
a) Display the details of SALES AND ACCOUNTS department employees.
b) Update the salary of Seema Singh to 100000.
c) Add a new column Bonus just after the column salary which is 15% of their salary.
d) Plot a Bar chart depicting Employee Name on X-axis and their salary and Bonus on Y-axis,
with appropriate Graph Title, X-Axis Title, Y-Axis Title, Legends and color etc.
35. Considering the above data frame answer the following by writing appropriate command
(set of commands) in Python Pandas.
NAME Gender POSITION CITY AGE PROJECTS BUDGET
Rabia F Manager Bangalore 30 13 48
Evan M Programmer New Delhi 27 17 13
Jia F Manager Chennai 32 16 32
Lalit M Manager Mumbai 40 20 21
Jaspreet M Programmer Chennai 28 21 17
Suji F Programmer Bangalore 32 14 10
a) Print the details of the youngest employee in the data frame. (1)
b) Print the details of the employee handling the maximum number of projects. (1)
c) Print the average budget allotted. (1)
d) Plot a Multi Line chart depicting employee-Name on X-axis and their projects and
Budget on Y-axis, with appropriate Graph Title, X-Axis Title, Y-Axis Title, Legends and
color etc. (2)

36. Data Frame named “Tch” storing the following details:

Tname Post Subject salary


101 R. K. Sharma PGT Maths 80000
102 Shiv Bansal TGT Hindi 45000
103 Raman Ahuja PRT English 35000
104 Nidhi Sharma PGT IP 75000
105 Seema Singh PGT CS 85000
106 Aman Singh TGT Science 45000

Considering the above data frame answer the following by writing appropriate
command (set of commands) in Python Pandas.
a) Display Teacher Name, Subject and Salary for all TGT Teachers. (1)
b) Add a row for a PRT teacher, assuming your own data . (1)
c) Plot a Multi Line chart depicting Teacher-Name on X-axis and their salary and
Bonus on Y-axis, with appropriate Graph Title, X-Axis Title, Y-Axis Title, Legends
and color etc. (3)

You might also like