Professional Documents
Culture Documents
KMS Ip Xii
KMS Ip Xii
SECTION – A
Section A consists of 25 questions, attempt any 20 questions.
9. What is the correct syntax to return both the first row and the second
row in a Pandas DataFrame df?
a. df.loc[[0,1]]
b. df.[[0,1]]
c. df.loc[[0-1]]
d. df.[[0-1]]
a. plt
b. ps
c. pd
d. pt
12. Which of the following statement will print Series ‘S1’ in reverse order?
a. print(S1[: : 1])
b. print(S1[: : -1])
c. print(S1[-1: : 1])
d. print(S1.reverse( ))
Std.12. Pg 2 of 11
15. Using Python Matplotlib ___________ can be used to count how many
values fall into each interval.
a. line plot
b. bar graph
c. histogram
d. None of the above
16. Online posting of rumors, giving threats online, posting the victim’s
personal information, comments aimed to publicly ridicule a victim is
termed as __________
a. Cyber bullying
b. Cyber crime
c. Cyber insult
d. All of the above
18. A software that can be freely accessed and modified is called _______
a. Synchronous software
b. Package Software
c. Open source software
d. Middleware
22. Which of the following command will display the column labels of the
DataFrame?
a. print(emp.column)
b. print(emp.‘column’)
c. print(emp.columns())
d. print(emp.columns)
Std.12. Pg 3 of 11
23. CEO needs to know the salary of the employee with accno 1421. Help
him to identify the correct set of statement/s from the given options:
a. emp1=emp[[‘accno’]==1421]
b. emp1=emp[accno]=1421
c. emp1=emp[emp.accno=1421]
d. emp1=emp[emp.accno==1421]
24. While accessing the column from the data frame, we can specify the
column name. In case column does not exist, which type of error it will
raise:
a. Key Error
b. Syntax Error
c. Name Error
d. Runtime Error
SECTION – B
Section B consists of 24 Questions (26 to 49). Attempt any 20 qns.
b.
a 14
b 7
dtype: int64
c. Error
d. None of the above
a. S2.index
b. S2.length
c. S2.values
d. S2.size
Std.12. Pg 4 of 11
28. What will be the output for the following code:
import pandas as pd
fst=[9,10,11]
ser1=pd.Series(data=fst*2)
print(ser1)
a. 0 9
1 10
2 11
3 9
4 10
5 11
b. 0 18
1 20
2 22
c. Error
d. None of these
29. Anushka is using her internet connection to book a train ticket. This
is a classic example of leaving a trail of web activities carried by her.
What do we call this type of activity?
a. Digital login
b. Digital Footprint
c. Digital Log off
d. Digital Error
30. Consider the following graph. Write the code to plot it.
Std.12. Pg 5 of 11
c.import matplotlib.pyplot as plt
a = [1,2,3,4,5]
b = [10,31,26,24,20]
plt.plot(b,a)
plt.show()
31. 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()
Statement B: The bin parameter is compulsory to create histogram.
a. Statements A and B are correct
b. Statements A and B are incorrect
c. Statement A is correct, but Statement B is incorrect
d. Statement A is incorrect, but Statement B is correct
32. Which of the following function will create a vertical bar chart ?
a. plot( )
b. bar( )
c. plotbar()
d. barh( )
34. Which of the following statement will modify the first three values of
Series ‘S1’?
a. S1[0, 1, 2] = 100
b. S1[0 : 3] = 100
c. S1[ : 3] = 100
d. All of the above
a.
90 Marks1
95 Marks2
97 Marks3
Std.12. Pg 6 of 11
b. Marks1 90
Marks2 95
Marks3 97
37. Write correct Python statement to display 2nd and 3rd rows and 6th and
7th columns from a DataFrame Sales.
a. Sales.iloc[1:3,5:7]
b. Sales.loc[2:4,6:7]
c. Sales.iloc[2:4,6:7]
d. None of the above
38. The following code creates a dataframe named ‘D1’ with ______ rows.
import pandas as pd
L = [{'a':10, 'b':20}, {'a':5, 'b':10, 'c':20}]
D1 = pd.DataFrame(L)
a. 0
b. 1
c. 2
d. 3
40. Mr. Ankit wants to change the index of the Data Frame and the output
for the same is given below. Identify the correct statement to change the
index.
a. df.index[]=["Air India","Indigo","Spicejet"]
b. df.index["Air India","Indigo","Spicejet"]
c. df.index=["Air India","Indigo","Spicejet"]
d. df.index()=["Air India","Indigo","Spicejet"]
Std.12. Pg 7 of 11
41. Replace the row label ‘Ankit’ with ‘Ankita’ in dataframe ‘DF’
a. DF.Rename({‘Ankit’ : ‘Ankita’})
b. DF.rename({‘Ankit’ : ‘Ankita’})
c. DF.repalce({‘Ankit’:’Ankita’})
d. None of the above
42. To select rows where 50 and above marks are scored in English subject
a. df[df[‘English’]>50]
b. df[df[‘English’]>=50]
c. df[df[‘English’]=>50]
d. df[df[‘English’]==50]
a.
a 0
v -1.0
w 2.0
x NaN
y 2.0
z 8.0
b.
a NaN
v -1.0
w 2.0
x NaN
y 2.0
z 8.0
c.
v -1.0
w 2.0
y 2.0
z 8.0
d.
a NaN
v -1.0
w 2.0
x 3.0
y 2.0
z 8.0
Std.12. Pg 8 of 11
45. Which argument is used to change the width of line in line graph?
a. markersize
b. linestyle
c. linewidth
d. width
a. df(‘eligible’) = ‘yes’
b. df[‘eligible’] == ‘yes’
c. df[‘eligible’] = ‘yes’
d. None of the above
48. Consider two dataframes df1 and df2, select the correct statement to
combine these two dataframes.
Choose the command to add 4th row (given below) into df_marks.
new_row = {'name':'Geo', 'physics':87, 'chemistry':92, 'algebra':97}
Std.12. Pg 9 of 11
SECTION - C
Section C, consists of 6 Question (50 to 55). Attempt any 5 qns.
CASE STUDY
50. He wants to select all the rows from the given dataframe in which
‘Percentage’ is greater than 80 .
a. rslt_df = df[df['Percentage'] > 80]
b. rslt_df = df['Percentage'> 80]
c. rslt_df = df[df[Percentage] > 80]
d. rslt_df = df[df(['Percentage'] > 80)]
51.Help him to select Name and Percentage of 2nd and 3rd student .
a. print(df.iloc[1:3, ['Name', 'Percentage']])
b. print(df.loc[0:2, 'Name', 'Percentage'])
c. print(df.iloc[0:2, ['Name', 'Percentage']])
d. print(df.loc[1:3, ['Name', 'Percentage']])
52. He wants to add a new column ‘Regno’ as the first column with values
[1201,1202, 1203,1204,1205,1206]
a. df.insert(1, "Regno", [1201,1202,1203,1204,1205,1206])
b. df.insert(0, Regno, [1201,1202,1203,1204,1205,1206])
c. df.insert(0, "Regno", [1201,1202,1203,1204,1205,1206])
d. df.append(0, "Regno", [1201,1202,1203,1204,1205,1206])
a. (4, 4)
b. (5, 4)
c. (4, 5)
d. (5, 5)
Std.12. Pg 11 of 11