IP - Class XII
IP - Class XII
IP - Class XII
SENIOR SECONDARY
General Instructions:
The paper is divided into 3 Sections- A, B and C.
Section A, consists of Question 1 to 25 and student need to attempt 20
questions.
Section B, consists of Question number 26 to 49 and student need to
attempt 20 questions.
Section C, consists of Question number 50 to 55 and student need to
attempt 5 questions.
All questions carry equal marks (0.77 mark per question).
SECTION – A
Section - A consists of 25 questions, attempt any 20 questions
Page 1 of 10
9. While creating dataframe if number of index values is not equal to
number of rows, which type of error it will raise?
(a) Key Error (b) Syntax Error (c) Name Error (d) Value Error
(a) Digital Finger Print (b) Digital Footprint (c) Digital Hand print
(d) Digital data
Directions (Q No. 17 to 21) Read the extract given below and
answer the questions on the basis of the same.
Mr. Mathur wants to write Python code to create the following data
frame containing marks of 3 students. However, he is facing some
problems. Help him by answering a few questions below.
Page 2 of 10
Code to create the dataframe:
import pandas as pd
df=pd.DataFrame([[21.22.19],[23.22.16],[30.25.26],\
_______=[„S1‟,„S2‟,„S3‟])#statement 1
df._______=[„M1,„M2‟,„M3‟] #statement 2
print(df)
17. Choose the right code for statement 1.
(a) row (b) column (c) index (d) columns
18. He wants to rename the column M1 to MT1, which command should he
execute?
(a) df=df.rename(column={'M1':'MT1'}, inplace=True)
(b) df=df.rename({'M1':'MT1'})
(c) df=df.rename(columns={'M1':'MT1'},inplace=True)
(d) df=df.rename(column={'M1':'MT1'})
19. Choose the right code for statement 2.
(a) column (b) columns (c) value (d) values
20. Which of the following commands will output 2 for the above given Data
Frame?
(a) df.size (b) df.ndim (c) df.shape (d) df.index
21. He wants to obtain the sum of marks for each student as given below:
Choose the correct statement toobtain the same.
S1 62
S2 61
S3 81
dtype: int64
(a) print(df.sum(axis=0)) (b) print(df.sum())
(c) print(df.sum(0)) (d) print(df.sum(1))
22. What is the correct syntax to return both the first row and the second
row in a Pandas Data Frame df?
(a) df.loc[[0,1]] (b) df.[[0,1]] (c) df.loc[[0-1]] (d) df.[[0-1]]
23. Name the primary law in india dealing with cybercrime and electronic
commerce.
(a) Crime law (b) Cyber Law (c) IT Act (d) IT Law
Page 3 of 10
SECTION – B
Section-B consists of 24 Questions (26 to 49). Attempt any 20 questions.
26. To display the 3rd, 4th and 5th columns from the 6th to 9th rows of a
dataframe DF; you can write ___________.
(a) DF.iloc[5 : 9, 3 : 5] (b) DF.iloc[6 : 9, 3 : 6]
(c) DF.iloc[6 : 10, 3 : 6] (d) DF.iloc[6 : 9, 3 : 5]
27. Which of the following command will display the column labels of the
DataFrame?
(a) print(emp.columns()) (b) print(emp.column())
(c) print(emp.column) (d) print(emp.columns)
28. A Data Frame is having True and False as its boolean indexes. The
command that can be used to access all the rows corresponding to True
boolean index is
(a) print(df.loc(True) (b) print(df.loc[:,True])
(c) print(df.loc[True]) (d) print(df.loc(True,:)
29. Write the output of the following :-
import pandas as pd
S=pd.Series([1,2,3,4,5], index=[„a‟, „b‟, „c‟, „d‟, „e‟])
print(S[::-4])
(a) e 5 (b) a 1 (c) a 1 (d) e 5
a 1 e 5 d 4 d 2
30. A Social science teacher wants to use a pandas series to teach about Indian
historical monuments and its states. The series should have the monument
names as values and state names as indexes which are stored in the given
lists. Choose the statement which will create the series : -
import pandas as pd
monuments=[„QUTAB MINAR‟, „GATEWAY OF INDIA‟, „RED FORT‟, „TAJ MAHAL‟]
state=[„DELHI‟,‟MAHARASTRA‟,‟DELHI‟,‟UTTAR PRADESH‟]
a. S=df.Series(Monuments,index=state)
b. S=pd.Series(state,monuments)
c. S=pd.Series(Monuments,index=State)
d. None of these
31. Which of the following code will generate the following output?
Jan 31
Feb 28
Mar 31
dtype: int64
(a) import pandas as pd
S1 = pd.Series(data = [31, 28, 31], index=["Jan","Feb","Mar"])
print(S1)
(b) import pandas as pd
S1 = pd.Series([31, 28, 31], index=["Jan", "Feb", "Mar"])
print(S1)
(c) Both of the above
(d) None of the above
Page 4 of 10
32.
Observe the above figure. Identify the coding for obtaining this as
output.
Identify the coding for obtaining this as output.
(a) import matplotlib.pyplot as plt
eng_marks=[10,55,30,80,50]
st_name=[“amit”, “dinesh”, “abhishek”, “piyush”, “rita”]
plt.plot(st_name, eng_marks)
plt.show()
(b) import matplotlib.pyplot as plt
eng_marks=[10,55,30,80,50]
st_name=[“amit”, “dinesh”, “abhishek”, “piyush”, “rita”]
plt.plot(eng_marks, st_name)
plt.show()
(c) import matplotlib.pyplot as plt
eng_marks=[10,55,30,80,50]
st_name=[“amit”, “dinesh”, “abhishek”, “piyush”, “rita”]
plt.plot(engmarks, st_name)
plt.show()
(d) import matplotlib.pyplot as plt
eng_marks=[10,55,30,80,50]
st_name=[“amit”, “dinesh”, “abhishek”, “piyush”, “rita”]
plt.plot(eng_marks, stname)
plt.show()
Page 5 of 10
36. What will be the output of the following?
>>> seriesMnths = pd.Series([2,3,4,index=[“Feb”,“Mar”,“Apr”])
>>> seriesMnths[1]
(a) 2 (b) Mar (c) Feb (d) 3
37. Choose the correct output of the following code:
>>> seriesCapsCntry = pd.Series([„NewDelhi‟,„WashingtonDC‟,„London‟,
„Paris‟],index=[“India”, “USA”, “UK”, “France”])
>>> seriesCapCntry[[3,2]]
(a) France Paris
France Paris
(b) USA WashingtonDC
France Paris
(c) France Paris
UK London
(d) USA WashingtonDC
UK London
38. Choose the correct code that produces the output below:
9 18
10 20
11 22
12 24
(a) a=np.arange(9, 13)
s1=pd.Series(index=a, data=a*2)
print(s1)
(b) a=[9, 10, 11, 12]
s1=pd.Series(index=a, data=a*2)
print(s1)
(c) Both the above
(d) None of the above
39. Difference between drop() and del
(a) Both operates on columns and rows
(b) del operates on column only
(c) drop operates on column only
(d) del operates on rows only
40. Sumesh‟s continuous online classes and increasing use of computers
made his mother worried about his health.
Which of the following point should not be suggested by his mother to
take care of.
(a) Sit in right position
(b) Take breaks and do some physical activity
(c) Keep the gadgets above your height
(d) All the above
41. Mr. Vasu has designed a Open source software which must comply with
some criteria. Choose right statement in respect of above.
Statement I: No restriction on re-distribution of the software as a part or
whole
Page 6 of 10
Statement II: The integrity of the Author‟s source code must be
maintained
Statement III: The software can be sold after distribution
(a) Statement I is False (b) Statements I and II are True
(c) Statements II and III are True (d) Statements I, II and III are True
42. Write short code to show the information having city=”Delhi” from data
frame SHOP
(a) print(SHOP[City= “Delhi”])
(b) print(SHOP[SHOP.City== “Delhi”])
(c) print(SHOP[SHOP. “City”== “Delhi”])
(d) print(SHOP[SHOP [City]== “Delhi”])
44. Which argument must be set with plotting functions for legend( ) to
display the legends ?
(a) data (b) label (c) name (d) sequence
Page 7 of 10
Output Required: (3.5)
(a) print(df.shape())
(b) print(df.shape)
(c) print(df.size)
(d) print(df.size())
47. The correct statement to read from a CSV file in a dataframe is :
(a) <DF>.read_csv(<file>)
(b) <File>. read_csv( )(<DF>)
(c) <DF> = pandas.read(<file>)
(d) <DF> = pandas.read_csv(<files>)
48. The command used to skip a row in a CSV file is
(a) next() (b) skip() (c) omit() (d) bounce()
49. The following cannot be exploited by assigning or by licensing the rights
to others.
(a) patent (b) design (c) trademark (d) all of the above
SECTION - C
Section - C, consists of 6 Question (50 to 55). Attempt any 5 questions.
Case Study
Radha is an analyst and working on some data. On which she wants to
do some operations, but she is facing some problem, help her:
Code:
import pandas as pd
AB={
'Naveen': pd.Series([90, 91, 97],
index=['Maths','Science','Hindi']),
'Rehana': pd.Series([92, 81, 96],
index=['Maths','Science','Hindi']),
'John': pd.Series([89, 91, 88],
index=['Maths','Science','Hindi']),
'Roja': pd.Series([81, 71, 67],
index=['Maths','Science','Hindi']),
'Mannat': pd.Series([94, 95, 99],
index=['Maths','Science','Hindi'])}
RS = pd.DataFrame(AB)
print(RS)
Output of the above code:
Page 8 of 10
data frame
choose the right command to do so:
(a) RS['Nirmal']=[89,78,76]
(b) rs[' Nirmal ']=[89,78,76]
(c) RS[' Nirmal ']=[89,78,76,67]
(d) RS['Name'] =[89,78,76]
51. She wants to set all the values to zero in data frame, choose the right
command to do so:
(a) RS=0 (b) RS[]=0 (c) RS[:]=0 (d) RS[:]==0
52. She wants to delete the row of science marks:
(a) RS.drop('Science', axis=1) (b) RS.drop('Science', axis=0)
(c) RS.drop('Science', axis=-1) (d) RS.drop('Science', axis==0)
53. The following code is to create another data frame, which She wants to
add to the existing Data frame. Choose the right command to do so:
Sheet1={ 'Aaradhya': pd.Series([90, 91, 97],
index=['Maths','Science','Hindi'])}
S1=pd.DataFrame(Sheet1)
(a) RS.append(S1,axis=0) (b) RS.append(S1) (c) RS.insert(S1)
(d) RS.join(S1)
54. What will be the output of the given command?
Page 9 of 10
print (RS.size)
a. 15
b. 18
c. 21
d. 23
****************************
Page 10 of 10