Data cleansing and preprocessing with cuDF and pandas: Practice Questions — Data Preparation (NVIDIA-Certified Professional: Accelerated Data Science)
Practice Questions: Data Cleansing and Preprocessing with cuDF and pandas These multiple-choice questions are designed to help you prepare for the...
Practice Questions: Data Cleansing and Preprocessing with cuDF and pandas
These multiple-choice questions are designed to help you prepare for the Data Preparation section of the NVIDIA-Certified Professional: Accelerated Data Science exam, focusing specifically on data cleansing and preprocessing using cuDF and pandas.
Which cuDF function is typically used to remove rows containing missing values from a DataFrame?
- A) dropna()
- B) fillna()
- C) replace()
- D) drop_duplicates()
Correct answer: A) dropna()
Explanation: The dropna() function removes rows with missing (NaN) values, which is a common data cleansing step. fillna() replaces missing values but does not remove rows.
When converting a pandas DataFrame to a cuDF DataFrame for GPU processing, which method is recommended?
- A) cudf.DataFrame(pandas_df)
- B) pandas_df.to_cudf()
- C) cudf.from_pandas(pandas_df)
- D) pandas_df.convert_to_cudf()
Correct answer: C) cudf.from_pandas(pandas_df)
Explanation: The cudf.from_pandas() function efficiently converts a pandas DataFrame to a cuDF DataFrame for accelerated GPU operations.
Which pandas function is used to standardize column names by removing leading/trailing whitespace and converting to lowercase?
- A) df.columns.strip().lower()
- B) df.columns = df.columns.str.strip().str.lower()
- C) df.rename(columns=lambda x: x.strip().lower())
- D) df.clean_columns()
Correct answer: B) df.columns = df.columns.str.strip().str.lower()
Explanation: The str.strip() and str.lower() string methods applied to the columns attribute standardize column names. Option C is close but does not assign the result back.
In cuDF, which method would you use to replace all occurrences of a specific value in a column?
- A) replace()
- B) fillna()
- C) map()
- D) dropna()
Correct answer: A) replace()
Explanation: The replace() method substitutes specified values with new ones, useful for correcting or standardizing data entries.
Which pandas function helps identify duplicate rows in a DataFrame before deciding to remove them?
- A) duplicated()
- B) drop_duplicates()
- C) unique()
- D) isnull()
Correct answer: A) duplicated()
Explanation: duplicated() returns a boolean Series indicating duplicate rows, allowing inspection before removal. drop_duplicates() removes duplicates directly.
Which of the following is a key advantage of using cuDF over pandas for data preprocessing?
- A) Supports more file formats
- B) Runs on CPU with multi-threading
- C) Accelerated GPU processing for large datasets
- D) Automatically fixes missing data
Correct answer: C) Accelerated GPU processing for large datasets
Explanation: cuDF leverages NVIDIA GPUs to speed up data cleansing and preprocessing tasks, especially beneficial for large-scale data.
Which pandas method is used to fill missing values with a specified constant?
- A) fillna()
- B) dropna()
- C) replace()
- D) interpolate()
Correct answer: A) fillna()
Explanation: fillna() replaces missing values with a specified value, which is a common preprocessing step to handle incomplete data.
In a data preprocessing pipeline, why is it important to monitor bottlenecks when using cuDF and pandas?
- A) To ensure data is encrypted
- B) To optimize performance and resource usage
- C) To increase data redundancy
- D) To reduce the number of columns
Correct answer: B) To optimize performance and resource usage
Explanation: Monitoring bottlenecks helps identify slow stages in the pipeline, enabling targeted optimization for faster data processing and efficient GPU utilization.
More in this topic
Preparing for the NCP-ADS exam?
Start free with 5 practice quizzes a day and track your progress.
Practise NCP-ADS questions free →