AMP

Chapter-2 Data Handling using Pandas - II — Online MCQ Test

INFORMATICS PRACTICES · Grade 12 · CBSE(NCERT)
Practice Chapter-2 Data Handling using Pandas - II with a free chapter-wise online MCQ test. This chapter covers: DataFrame operations - missing values - NaN - descriptive statistics - mean - median - mode - sorting - CSV import - CSV export. AI-generated questions from basic to board-exam level, with instant results and explanations.

Start Exam on Full Site →

Chapter-2 Data Handling using Pandas - II — Important Questions & Answers

What does NaN stand for in pandas?
  • A. Not a Number
  • B. Not a Name
  • C. Null and Null
  • D. No Available Number
Answer: A. Not a Number
NaN is a standard representation in pandas and NumPy for missing or undefined numerical values.
Which method is used to check for missing values in a pandas DataFrame?
  • A. isnull()
  • B. ismissing()
  • C. findnull()
  • D. checknull()
Answer: A. isnull()
The isnull() method returns a boolean DataFrame indicating which values are NaN or missing.
If a DataFrame has missing values represented as NaN, which method fills them with the mean value?
  • A. df.fill_na()
  • B. df.fillna(df.mean())
  • C. df.replace_missing()
  • D. df.impute_mean()
Answer: B. df.fillna(df.mean())
The fillna() method combined with mean() fills NaN values with the mean of the respective column.
Consider a student marks DataFrame. If you need to identify and count all missing values across the entire DataFrame, which method would you use?
  • A. df.count_na()
  • B. df.isnull().sum().sum()
  • C. df.missing_values()
  • D. df.count_missing()
Answer: B. df.isnull().sum().sum()
df.isnull() returns boolean values, .sum() counts NaN per column, and another .sum() totals across all columns.
Consider a scenario where you need to keep track of which values were originally missing after imputation. What would be the best approach?
  • A. Don't impute, just use dropna()
  • B. Create a separate boolean column marking NaN locations before imputation
  • C. Impute and then check describe() for changes
  • D. Use fillna() with a unique marker value instead of statistics
Answer: B. Create a separate boolean column marking NaN locations before imputation
Creating a mask column before imputation preserves information about original missing values for auditing and analysis.