wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Long Quiz | Data Preparation

Total questions: 30

Worksheet time: 15mins

Name
Class
Date
1.

If a dataset has 100 rows, and after running df.dropna(how="all") there are 90 rows left, how many empty rows were deleted?

a)

a. 5

b)

b. 10

c)

c. 15

d)

d. 20

2.

Which pandas function is used to remove rows that are completely empty?

a)

df.dropna(how="any")

b)

df.drop_duplicates()

c)

df.dropna(how="all")

d)

df.fillna(0)

3.

What does df.drop_duplicates() do?

a)

Fills missing values with zero

b)

Removes duplicate rows

c)

Removes all empty rows

d)

Splits text into multiple columns

4.

The parameter errors="coerce" in pd.to_numeric() means:

a)

Replace invalid entries with NaN

b)

Skip conversion if error happens

c)

Raise an error if a non-numeric is found

d)

Convert numbers into strings

5.

In pandas, text data is usually stored as what dtype by default?

a)

int64

b)

float64

c)

string[python]

d)

object

6.

The command df.dropna(how="all") removes only the rows where every column is empty.

a)

True

b)

False

7.

df.drop_duplicates() will delete only empty rows, not duplicate rows.

a)

True

b)

False

8.

The command df["Notes"].str.split(",", expand=True) splits the Notes column into multiple columns whenever a comma is found.

a)

True

b)

False

9.

The function len(df) counts how many columns the dataset has.

a)

True

b)

False

10.

If you write only df in a Jupyter cell, it will display the entire dataset.

a)

True

b)

False

11.

Which command removes duplicate rows across the whole dataset?

a)

df.dropna()

b)

df.drop_duplicates()

c)

df.remove_duplicates()

d)

df.delete_duplicates()

12.

Which argument lets you remove duplicates from a specific column only?

a)

subset=["Student_ID"]

b)

column=["Student_ID"]

c)

unique=["Student_ID"]

d)

id=["Student_ID"]

13.

By default, when using drop_duplicates(), pandas keeps:

a)

All duplicates

b)

The last occurrence of the duplicate

c)

The first occurrence of the duplicate

d)

None of the rows

14.

Which command shows only the first 10 rows of the DataFrame?

a)

df.head(10)

b)

df.show(10)

c)

df.print(10)

d)

df.display(10)

15.

What does the command len(df) return?

a)

The number of rows

b)

The number of columns

c)

The number of duplicates

d)

The total file size

16.

Which string-building code correctly shows the results of duplicate removal?

a)

"Removed: " + removed

b)

"Removed: ", removed

c)

removed + "Removed"

d)

"Removed: " + str(removed)

17.

Why is removing duplicates important in data preparation?

a)

To make the dataset smaller in file size

b)

To remove all missing values

c)

To make the dataset easier to save in Excel

d)

To avoid repeated values that can affect analysis

18.

After removing duplicates, which code correctly counts the new number of rows?

a)

df.count()

b)

df.shape[1]

c)

len(df)

d)

df.size

19.

The command df.to_excel("file.xlsx", index=False) is used to save the cleaned dataset into a new Excel file.

a)

True

b)

False

20.

We can find duplicates in a specific column using the subset parameter.

a)

True

b)

False

21.

What does .str.strip() do in the command df["Department"].astype(str).str.strip()?

a)

Removes spaces before and after text

b)

Removes all vowels in the text

c)

Changes text to lowercase

d)

Replaces missing values with NaN

22.

Which command shows all unique values of the Department column?

a)

df["Department"].all()

b)

df["Department"].nunique()

c)

df["Department"].unique()

d)

df["Department"].value_counts()

23.

Which of the following best describes "data inconsistency"?

a)

Duplicate rows in a dataset

b)

Empty rows with no values

c)

Incorrect or misspelled entries in the data

d)

Columns with mixed data types

24.

df["Department"].astype(str).str.strip() will automatically correct wrong spellings like “Accguntancy” to “Accountancy.”

a)

True

b)

False

25.

Using .unique() on a column helps in spotting inconsistent spellings of department names.

a)

True

b)

False

26.

Which line correctly changes GPA to float numbers?

a)

df["GPA"] = df["GPA"].astype("float64")

b)

df["GPA"] = df["GPA"].astype("int64")

c)

df["GPA"] = df["GPA"].astype("string")

d)

df["GPA"] = df["GPA"].astype("object")

27.

The command df.dtypes shows the current data types of all columns.

a)

True

b)

False

28.

The default dtype for text columns in pandas is string.

a)

True

b)

False

29.

Splitting a text column into multiple columns is an example of data preparation.

a)

True

b)

False

30.

Data type conversion is unnecessary if the dataset loads without errors.

a)

True

b)

False