MCQ FOR CLASS XII - 2026
|
Sl No |
MCQ QUESTIONS |
|
1 |
To
display the 3rd, 4th and 5th columns from the 6th to 9th rows of a dataframe
you can write
(a)
DF.loc[6:9, 3:5] (b)
DF.loc[6:10, 3:6] (c) DF.iloc[6:10, 3:6] (d)
DF.iloc[6:9, 3:5]
ANS: c) DF.iloc[6:10, 3:6] |
|
2 |
We can add a new row to a DataFrame using the method (i) rloc[ ] (ii) loc[ ] (iii) iloc[ ] (iv) None of the above ANS: (ii) loc[ ] |
|
3 |
The
head() function of dataframe will display how may rows from top if no
parameter is passed. (i) 1 (ii) 3 (iii) 5 (iv) None of these
ANS : (iii) 5 |
|
4 |
To change
the 5th column's value at 3rd row as 35 in dataframe DF, you can write
(a)
DF[4, 6] = 35 (b)
DF.iat[4, 6] = 35 (c) DF[3, 5] = 35 |

|
|
(d) DF.iat[3, 5] = 35
ANS:- d) DF.iat[3, 5] = 35 |
|
5 |
Which
function is used to find values from a DataFrame D using the index number? a)
D.loc b)
D.iloc c) D.index d)
None of these
ANS:
b) D.iloc |
|
6 |
In a DataFrame, Axis= 0 represents the elements
a.rows b.columns c.both d.None of these.
ANS: a.rows |
|
7 |
In DataFrame, by default
new column added as the column (i) First (Left Side) (ii) Second (iii) Last (Right Side) (iv) Any where in dataframe
ANS: (iii)Last (Right Side) |
|
8 |
Which of the following is correct Features
of DataFrame? a.
Potentially columns are of different types b.
Can Perform Arithmetic operations on rows and columns c. Labeled axes (rows and columns) d.
All of the above
ANS: d. All of the above |
|
9 |
Write the code to append
df2 with df1
a. Df2=Df2.append(Df1) b. Df2=Df2+Df1 c. Df2=Df2.appendwith.Df1 d. Df2=Df1.append(Df1)
ANS: a.Df2=Df2.append(Df1) |
|
10 |
When we create DataFrame from List of Dictionaries, then
number of columns in DataFrame isequal to the a.
maximum number of keys in first dictionary of the list b.
maximum number of different keys in all dictionaries of the list c. maximum number
of dictionaries in the list |

|
|
d. None of the above
ANS: b. maximum number of different keys in all dictionaries of the list |
|
11 |
When we create DataFrame from List of Dictionaries, then
dictionary keys will become (i) Column labels (ii) Row labels (iii) Both of the above (iv) None of the above
ANS: (i) Column labels |
|
12 |
Which method is used to access vertical
subset of a dataframe? (i) iterrows() (ii) iteritems() (iii) itercolumns() (iv) itercols()
ANS: (ii) iteritems() |
|
13 |
Write statement to transpose dataframe DF. (i) DF.t (ii) DF.transpose (iii)DF.T (iv)DF.T( )
ANS: (iii)DF.T |
|
14 |
In DataFrame, by default
new column added as the column a.
First (Left Side) b.
Second c.
Last (Right Side) d.
Any where in dataframe
ANS: Last
(Right Side) |
|
15 |
We can add a new row to a DataFrame using the method (i)
rloc[ ] (ii)
loc[ ] (iii)
iloc[ ] (iv)
None of the above
ANS: (ii) loc[ ] |
|
16 |
Which of
the following function is used to load the data from the CSV file to DataFrame?
(i)
read.csv( ) (ii)
readcsv( ) (iii)
read_csv( ) (iv)
Read_csv( ) |

|
|
ANS: (iii) read_csv( ) |
|
17 |
Which of the following function
is not a Boolean reduction function (i) Empty (ii) Any() (iii) All() (iv) Fillna()
ANS: (iv) Fillna() |
|
18 |
Which
among the following options can be used to create a DataFrame in Pandas ? (a) A scalar value (b)
An ndarray (c) A python dict (d)
All of these
ANS:- (d) All of these |
|
19 |
Which
attribute of a dataframe is used to convert row into columns and columns into
rows in a dataframe? a)
T b)
ndim c) empty d)
shape
ANS: a) T |
|
20 |
When we create DataFrame from List of Dictionaries, then
number of columns in DataFrame is equal to the (i) maximum number
of keys in first dictionary of the list (ii) maximum number
of different keys in all dictionaries of the list (iii) maximum number
of dictionaries in the list (iv) None of the above
ANS: (ii) maximum number
of different keys in all dictionaries of the list |
|
21 |
Which of the following is/are characteristics of DataFrame? a)
Columns are of different types b)
Can Perform Arithmetic operations c) Axes are labeled (rows
and columns) d)
All of the above
ANS: d) All of the above |
|
22 |
Write
short code to show the information having city=”Delhi” from dataframe SHOP.
(a)
print(SHOP[City==’Delhi’]) (b)
print(SHOP[SHOP.City==’Delhi’]) (c) print(SHOP[SHOP.’City’==’Delhi’]) (d)
print(SHOP[SHOP[City]==’Delhi’]) |

|
|
ANS: (b) print(SHOP[SHOP.City==’Delhi’]) |
|
23 |
Which of the following commands is used to install pandas? (i)pip install python
–pandas (ii)pip
install pandas (iii)python install python (iv)python install pandas
ANS: (ii) pip install
pandas |
|
24 |
Which
attribute of a dataframe is used to get number of axis? a.T b.Ndim c.Empty d.Shape
ANS: b.Ndim |
|
25 |
Display first row of dataframe ‘DF’ (i) print(DF.head(1)) (ii) print(DF[0 : 1]) (iii) print(DF.iloc[0 : 1])
(iv)All of the above
ANS: (iv)All
of the above |
|
26 |
To delete a column from a DataFrame, you may use statement. (a)
remove (b)
del (c) drop (d)
cancel statement.
ANS:- (b) del |
|
27 |
In given code dataframe ‘Df1’ has rows and columns import pandas as pd dict= [{‘a’:10, ‘b’:20}, {‘a’:5, ‘b’:10, ‘c’:20},{‘a’:7, ‘d’:10, ‘e’:20}] Df1 = pd.DataFrame(dict) (i) 3, 3 (ii) 3, 4 (iii) 3, 5 (iv) None of the above
ANS: (iii)3, 5 |
|
28 |
To delete a row from a DataFrame, you may use (a)
remove (b)
del (c) drop (d)
cancel |

|
|
ANS:- (c) drop |
|
29 |
In the following statement, if column ‘mark’ already
exists in the DataFrame ‘Df1’ then the assignment statement will Df1['mark']
= [95,98,100] #There are only three rows in DataFrame Df1 (i) Return error (ii) Replace the already existing
values. (iii) Add new column (iv) None of the above
ANS: (ii) Replace the already
existing values. |
|
30 |
To skip
first 5 rows of CSV file, which argument will you give in read_csv( ) ?
(a)
skip_rows = 5 (b)
skiprows = 5 (c) skip - 5 (d)
noread - 5
ANS:- (a) skip_rows = 5 |
|
31 |
. Which of the following statement is false: i.
DataFrame is size mutable ii.
DataFrame is value mutable iii.
DataFrame is immutable iv.
DataFrame is capable
of holding multiple types of data
ANS:- iii. DataFrame is immutable |
|
32 |
Which of the following statements is false? (i) Dataframe is size mutable (ii) Dataframe is value mutable (iii) Dataframe is immutable (iv) Dataframe is capable of holding multiple type of data
ANS: (iii)
Dataframe is immutable |
|
33 |
To delete a row, the parameter axis of function drop( ) is assigned the value
(i)
0 (ii) 1 (iii) 2 (iv) 3
ANS: (i) 0 |
|
34 |
Which of
the following function is used to load the data from the CSV file to DataFrame? (i) read.csv( ) (ii) readcsv( )
(iii)read_csv( ) |

|
|
(iv)Read_csv( )
ANS: (iii)read_csv( ) |
|
35 |
Write code to delete rows those getting
5000 salary. (a)
df=df.drop[salary==5000] (b)
df=df[df.salary!=5000] (c) df.drop[df.salary==5000,axis=0] (d)
df=df.drop[salary!=5000]
ANS: (b) df=df[df.salary!=5000] |
|
36 |
DF1.loc[ ] method is used to # DF1 is a DataFrame (i) Add new row in a DataFrame ‘DF1’ (ii) To change the data values of a row to a particular value (iii) Both of the above (iv) None of the above
ANS: (iii)Both of the above |
|
37 |
To iterate over horizontal subsets
of dataframe, (a)
iterate( ) (b)
iterrows( ) function
may be used. (c) itercols( ) (d)
iteritems( )
ANS:- (b) iterrows( ) function may be used. |
|
38 |
Write code to delete the row whose
index value is A1 from dataframe df.
(a)
df=df.drop(‘A1’) (b)
df=df.drop(index=‘A1’) (c) df=df.drop(‘A1,axis=index’) (d)
df=df.del(‘A1’)
ANS: (a) df=df.drop(‘A1’) |
|
39 |
A
two-dimension labeled array that is an ordered collection of columns to store
heterogeneous data type is i.
Series ii.
ii. Numpy array iii.
iii. Dataframe iv.
iv. Panel
ANS:- iii. Dataframe |
|
40 |
To skip
1st, 3rd and 5th rows of CSV file, which argument will you give in read_csv(
) ? (a)
skiprows = 11315 (b) skiprows - (1, 3, 5] |

|
|
(c) skiprows = [1, 5, 1] (d) Any of these
ANS:- (b) skiprows - (1, 3, 5] |
|
41 |
In Pandas is used
to store data in multiple columns. (i)Series (ii) DataFrame (iii) Both of the above (iv) None of the above
ANS: (ii) DataFrame |
|
42 |
What is dataframe? a.
2 D array with heterogeneous data b.
1 D array with homogeneous data c. 2 D array with homogeneous data d.
1 D array with heterogeneous data
ANS: a. 2 D array with heterogeneous data |
|
43 |
In a DataFrame, Axis= 1 represents the elements (a)
Row (b)
Column (c) True (d)
False
ANS: (b) Column |
|
44 |
Which of the following is not an attribute of a DataFrame Object ? a.
index b.
Index c. size d.
value
ANS: b. Index |
|
45 |
To get top 5 rows of a dataframe, you may use (a)
head( ) (b)
head(5) (c) top( ) (d)
top(5)
ANS:- (a) head(
) ,
b) head(5) |
|
46 |
27.
To iterate over horizontal subsets
of dataframe, (a)
iterate( ) (b)
iterrows( ) function
may be used. (c) itercols( ) (d)
iteritems( ) |

|
|
ANS:- (b) iterrows( ) function may be used. |
|
47 |
Write code to delete the row whose
index value is A1 from dataframe df. (a)
df=df.drop(‘A1’) (b)
df=df.drop(index=‘A1’) (c) df=df.drop(‘A1,axis=index’) (d)
df=df.del(‘A1’)
ANS: (a) df=df.drop(‘A1’) |
|
48 |
A
two-dimension labelled array that is an ordered collection of columns to
store heterogeneous datatype is v.
Series vi.
ii. Numpy array vii.
iii. Dataframe viii.
iv. Panel
ANS:- iii.
Dataframe |
|
49 |
To skip
1st, 3rd and 5th rows of CSV file, which argument will you give in read_csv(
) ? (a)
skiprows = 11315 (b)
skiprows - (1, 3, 5] (c) skiprows = [1, 5, 1] (d)
Any of these
ANS:- (b) skiprows - (1, 3, 5] |
|
50 |
In a DataFrame, Axis= 1 represents the elements (a)
Row (b)
Column (c) True (d)
False
ANS: (b) Column |
|
51 |
NaN stands for: a.
Not a Number b.
None and None c. Null and Null d.
None a Number ANS: a. Not a
Number |
|
52 |
To get top 5 rows of a dataframe, you may use (a)
head( ) (b)
head(5) (c) top( ) (d)
top(5)
ANS:- (a) head(
) ,
b) head(5) |
|
53 |
The correct statement to read from a CSV file in a dataframeis : (a) .read_csv() |

|
|
(b) . read_csv( )() (c) = pandas.read() (d) = pandas.read_csv()
ANS:-
(d) = pandas.read_csv() |
|
54 |
To delete a column from a dataframe, you may use statement. i.
remove() ii.
ii. del() iii.
iii. drop() iv.
iv. cancel()
ANS:- iii. drop() |
|
55 |
The following code create
a dataframe named ‘Df1’ with columns. import pandas as pd Df1 = pd.DataFrame([10,20,30] ) (i) 1 (ii) 2 (iii) 3 (iv) 4
ANS: (i) 1 |
|
56 |
To delete a row from dataframe, you may use statement. i.
remove() ii.
ii. del() iii.
iii. drop() iv.
iv. cancel()
ANS:- ii. del() |
|
57 |
In a Data-Frame, Axis= 0 represents the elements along
the a.
Row b.
Column c. Row and Column Both d.
None of the above
ANS: a. Row |
|
58 |
method in
Pandas can be used to change the index of rows and columns of a Series or
Dataframe (a)
rename() (b)
reindex() (c) reframe() (d)
none of these
ANS: (b) reindex() |
|
59 |
Write the
single line command to delete the column “marks” from dataframe df using drop
function. (a) df=df.drop(col=‘marks’) |
|

|
|
(b)
df=df.drop(‘marks’,axis=col) (c) df=df.drop(‘marks’,axis=0) (d)
df=df.drop(‘marks’,axis=1)
ANS: (d) df=df.drop(‘marks’,axis=1) |
|
60 |
Which of the following is used to give user defined column
index in DataFrame? (i) index (ii) column (iii) columns (iv) colindex
ANS: (iii) columns |
|
61 |
The following statement will df = df.drop(['Name', 'Class', 'Rollno'], axis = 1) #df is a DataFrame object
a.
delete three columns
having labels ‘Name’,
‘Class’ and ‘Rollno’ b.
delete three rows having labels
‘Name’, ‘Class’ and ‘Rollno’ c. delete any three columns d.
return error
ANS:- a. delete three columns having labels ‘Name’,
‘Class’ and ‘Rollno’ |
|
62 |
Difference between loc() and iloc().: a.
Both are Label
indexed based functions. b.
Both are Integer
position-based functions. c. loc() is label based function and iloc() integer
position based function. d.
loc() is integer
position based function
and iloc() index position based function. ANS: c. loc() is label based
function and iloc() integer position based function. |
|
63 |
Which
command will be used to delete 3 and 5 rows of the data frame. Assuming the
data frame name as DF. a.
DF.drop([2,4],axis=0) b.
DF.drop([2,4],axis=1) c. DF.drop([3,5],axis=1) d.
DF.drop([3,5])
ANS: a DF.drop([2,4],axis=0) |
|
64 |
Assuming the given structure, which command will give us the given output: Output Required: (3,4)
a.
print(df.shape()) b. print(df.shape) |
|
|
|
c. print(df.size) d. print(df.size()).
ANS: b. print(df.shape) |
|
65 |
Write the
output of the given command: df1.loc[:0,'Name'] Consider the given dataframe.
a.
0 1405 VINAY Clerk b. VINAY c.
Works Manager d.
Clerk ANS : VINAY |
No comments:
Post a Comment
Please do not any spam in the comment box.