Class 12 IP Practice Assignment Series 2
Class 12 IP Practice Assignment Series 2
Series-2
Revision Practice MCQ Unsolved Questions 07-09-2021
Class 12
Topic- Pandas DataFrame Creation, Basic Details, Show Columns
Subject IP
Q1. Select the correct points of Pandas DataFrame:-
1. DataFrame is like a one-dimensional array like structure.
2. DataFrame is like a two-dimensional array like structure.
3. DataFrame hold homogeneous data.
4. DataFrame hold heterogeneous data.
5. DataFrame Size Immutable But Values of DataFrame Mutable.
6. DataFrame Size mutable(editable) and also Values of DataFrame mutable (editable).
a. 2, 4, 6 b. 1, 3, 5 c. All correct d. All incorrect
Q4. To create following emp dataframe, so select correct python code for this:-
emp
eid ename eheight
0 e1 john 25
1 e2 smith 30
2 e3 peter 22
import pandas as pd
a. emp=DataFrame(,‘eid’:*‘e1’, ‘e2’, ‘e3’+, ‘ename’ : *‘john’,’smith’,’peter’+, ‘eheight’:*25,30,22+-)
b. emp=pd.dataframe(,‘eid’:*‘e1’, ‘e2’, ‘e3’+, ‘ename’ : *‘john’,’smith’,’peter’+, ‘eheight’:*25,30,22+-)
c. emp=pd.DataFrame(,‘eid’:*‘e1’, ‘e2’, ‘e3’+, ‘ename’ : *‘john’,’smith’,’peter’+, ‘eheight’:*25,30,22+-)
Q5. To display above emp dataframe, so select correct python code for this:-
a. print(employee)
b. print(emp)
c. print(emp())
Q6. To display only ‘eid’ column of above emp dataframe, so select correct python code for this:-
a. print(emp.’eid’)
b. print(emp.eid)
c. print(eid)
Q7. To display only ‘eid’ column of above emp dataframe, so select correct python code for this:-
a. print(emp*‘eid’+)
b. print(emp.’eid’)
c. print(eid)
Q8. To display only ‘eid’ column of above emp dataframe, so select correct python code for this:-
a. print(employee.loc* : , ‘eid’+)
b. print(employee.’eid’)
c. print(eid)
Q9. To display only ‘eid’ column of above emp dataframe, so select correct python code for this:-
a. print(iloc[ : , 0])
b. print(emp.iloc[ : , 0])
c. print(eid)
Q10. To display only ‘ename’ column of above emp dataframe, so select correct python code for this:-
a. print(emp.loc* : , ‘ename’+)
b. print(emp.iloc[ : , 1])
c. print(emp.ename)
d. print(emp*‘ename’+)
e. All will display only ename column of emp dataframe
Q11. To display only ‘eheight’ column of above emp dataframe, so select correct python code for this:-
a. print(emp.loc* : , ‘eheight’+)
b. print(emp.iloc[ : , 2])
c. print(emp.eheight)
d. print(emp*‘eheight’+)
e. All will display only eheight column of emp dataframe
Q12. To display above emp dataframe, so select correct python code for this:-
a. print(emp.loc[ : , : ])
b. print(emp.iloc[ : , : ])
c. print(emp)
d. print(emp.values)
e. All will display emp dataframe
Q13. To display only ‘eid’ column of above emp dataframe, so select correct python code for this:-
a. print(emp.loc* : , ‘eid’+)
b. print(emp.iloc[ : , 0])
c. print(emp.eid)
d. print(emp*‘eid’+)
e. All will display only eid column of emp dataframe
b.
Name: eid, dtype: object
eid object
ename object
eheight int64
dtype: object
b.
eid e1
ename john
eheight 22
b.
eid e1
ename john
eheight 22
b.
eid e1e2e3
ename johnsmithpeter
eheight 77
b. No, It will display result of only numeric column mean ,here eheight mean will display.
b. No, It will display result of only numeric column median ,here eheight median will display.
b.
Name: eid, dtype: object
eid object
ename object
eheight int64
dtype: object
Q24. To display sum (77) of eheight column of emp dataframe, what are the alternate code for this.
a. print(emp.eheight.sum())
b. print(emp.loc[ : , 'eheight'].sum())
c. print(emp.iloc[ : , 2].sum())
d. print(emp.eheight.sum())
e. print(emp['eheight'].sum())
f. All above code will display sum of eheight column of emp dataframe without any error.
Q25. To display maximum eheight (30) value of emp dataframe, what are the alternate code for this.
a. print(emp.eheight.max())
b. print(emp.loc[ : , 'eheight'].max())
c. print(emp.iloc[ : , 2].max())
d. print(emp.eheight.max())
e. print(emp['eheight'].max())
f. All above code will display maximum eheight column of emp dataframe without any error.