Loading

Quipoin Menu

Learn • Practice • Grow

python-for-ai / Data Cleaning
mcq
Direction: Choose the correct option

Q1.

How do you check for missing values in a DataFrame?
A. df.missing()
B. Both A and B
C. df.isnull()
D. df.isna()
Direction: Choose the correct option

Q2.

How do you drop rows with any missing values?
A. df.remove_na()
B. Both A and B
C. df.dropna(how='any')
D. df.dropna()
Direction: Choose the correct option

Q3.

How do you fill missing values with a constant?
A. df.fillna(value)
B. df.ffill()
C. df.replace(np.nan, value)
D. Both A and C
Direction: Choose the correct option

Q4.

What does `df.duplicated()` return?
A. Count of duplicates
B. List of duplicate rows
C. Boolean Series indicating duplicate rows
D. None
Direction: Choose the correct option

Q5.

How do you remove duplicate rows?
A. df.unique()
B. df.drop_duplicates()
C. df.remove_duplicates()
D. df.duplicated(keep=False)
Direction: Choose the correct option

Q6.

How do you rename a column?
A. df.set_axis()
B. Both A and B
C. df.rename(columns={'old':'new'})
D. df.columns = ['new1','new2']
Direction: Choose the correct option

Q7.

What does `df['col'].astype('int')` do?
A. Converts column to float
B. Converts to string
C. None
D. Converts column to integer type
Direction: Choose the correct option

Q8.

How do you replace a specific value in a column?
A. Both A and B
B. df['col'].replace(old, new)
C. df['col'].map(lambda x: new if x==old else x)
D. df.replace({old: new})
Direction: Choose the correct option

Q9.

How do you drop a column by name?
A. del df['col']
B. df.drop(columns='col')
C. Both A and B
D. df.drop('col', axis=1)
Direction: Choose the correct option

Q10.

What does `df.ffill()` do?
A. Backward fill missing values
B. Drop missing values
C. None
D. Forward fill missing values