Skip to content
TestMacher
Chapter 2 · Class 12 Informatics Practices

Data Handling using Pandas — Important Questions

34 questions With answers CBSE format

SUMMARY: This chapter focuses on data manipulation and analysis using the Pandas library in Python.
KEY TOPICS: Pandas DataFrame, Pandas Series, data cleaning, data aggregation, data visualization, handling missing data, merging and joining data, groupby operations, reading and writing data files, data transformation.

Q1 1 Mark

Which of the following is the standard alias used to import pandas?

Ap
Bpd
Cpanda
Dpds
Check answerHide answer
Correct answer: Option 2 — pd
Q2 1 Mark

A 1-D labelled array in pandas is called a:

AList
BDataFrame
CSeries
DTuple
Check answerHide answer
Correct answer: Option 3 — Series
Q3 1 Mark

A 2-D tabular data structure in pandas is called a:

ASeries
BDataFrame
CPanel
DArray
Check answerHide answer
Correct answer: Option 2 — DataFrame
Q4 1 Mark

Which method is used to view the first 5 rows of a DataFrame?

Atop()
Bhead()
Cfirst()
Dshow()
Check answerHide answer
Correct answer: Option 2 — head()
Q5 1 Mark

Which attribute returns the number of rows and columns in a DataFrame?

Asize
Bshape
Clen
Ddim
Check answerHide answer
Correct answer: Option 2 — shape
Q6 3 Marks

Differentiate between Series and DataFrame in pandas with two points each.

Q7 3 Marks

Write Python code to create a Series of marks for 5 students.

Q8 3 Marks

Write Python code to create a DataFrame from a dictionary.

Q9 3 Marks

How can you read a CSV file into a DataFrame? Write the code.

Q10 3 Marks

Differentiate between iloc and loc indexers in pandas.

Q11 6 Marks

Write a Python program using pandas to create a DataFrame of 5 students with name marks and grade then display students with marks > 75.

Q12 6 Marks

Discuss any five DataFrame methods (head info describe shape columns) with examples.

Q13 6 Marks

Write Python code to add a new column 'percentage' to a DataFrame containing marks of 5 subjects.

Q14 6 Marks

Discuss aggregation functions in pandas (sum mean max min count) with examples.

Q15 6 Marks

Write Python code to read a CSV file containing employee data and print only employees with salary > 50000.

Q16 6 Marks

Differentiate between Series and DataFrame in pandas in tabular form on five features.

Q17 1 Mark

Assertion (A): Pandas is built on top of NumPy.

Reason (R): It uses NumPy arrays internally for performance.

Show explanationHide explanation
Correct answer: Option 1 — Both A and R are true, and R is the correct explanation of A.
Q18 1 Mark

Assertion (A): A Series can be created from a list dictionary or NumPy array.

Reason (R): Each element gets a default integer index unless specified.

Show explanationHide explanation
Correct answer: Option 1 — Both A and R are true, and R is the correct explanation of A.
Q19 1 Mark

Assertion (A): DataFrames can have heterogeneous data types.

Reason (R): Different columns can hold different data types.

Show explanationHide explanation
Correct answer: Option 1 — Both A and R are true, and R is the correct explanation of A.
Q20 1 Mark

Assertion (A): The describe() method gives statistical summary.

Reason (R): It includes count mean std min max and quartiles.

Show explanationHide explanation
Correct answer: Option 1 — Both A and R are true, and R is the correct explanation of A.
Q21 1 Mark

Assertion (A): The drop() method can remove rows or columns.

Reason (R): The axis parameter specifies the direction (0 = rows 1 = columns).

Show explanationHide explanation
Correct answer: Option 1 — Both A and R are true, and R is the correct explanation of A.
Q22 1 Mark

Statement 1: A Series is one-dimensional.

Statement 2: A DataFrame is two-dimensional.

Show answerHide answer
Correct answer: Option 1 — Both statements are true.
Q23 1 Mark

Statement 1: iloc uses integer position-based indexing.

Statement 2: loc uses label-based indexing.

Show answerHide answer
Correct answer: Option 1 — Both statements are true.
Q24 1 Mark

Statement 1: head(n) returns the first n rows of a DataFrame.

Statement 2: tail(n) returns the last n rows.

Show answerHide answer
Correct answer: Option 1 — Both statements are true.
Q25 1 Mark

Statement 1: read_csv() loads CSV data into a DataFrame.

Statement 2: to_csv() writes a DataFrame to a CSV file.

Show answerHide answer
Correct answer: Option 1 — Both statements are true.
Q26 1 Mark

Statement 1: fillna() replaces missing values.

Statement 2: dropna() removes rows or columns containing missing values.

Show answerHide answer
Correct answer: Option 1 — Both statements are true.
Q27 3 Marks
A teacher has student marks in a CSV file with columns name maths physics chemistry. She loads it into a pandas DataFrame to compute the average marks per subject identify the topper and find students who scored less than 33 in any subject.
  1. A 2-D tabular data structure in pandas is a:
    ASeries
    BDataFrame
    CIndex
    DTuple
  2. Which method loads a CSV file into a DataFrame?
    Aread_csv()
    Bread_table()
    Cread_excel()
    Dload_csv()
  3. Write the complete pandas program to compute averages identify the topper and list failing students.
Show answersHide answers
1. Option 2 — DataFrame
2. Option 1 — read_csv()
3. import pandas as pd; df = pd.read_csv('marks.csv'); df['avg'] = df[['maths' 'physics' 'chemistry']].mean(axis=1); topper = df.loc[df['avg'].idxmax()]; failed = df[(df['maths']<33) | (df['physics']<33) | (df['chemistry']<33)]. The mean(axis=1) computes row averages; idxmax() returns the index of the maximum; boolean indexing filters rows.
Q28 5 Marks

Match each pandas object with its dimensionality and creator.

ObjectDimensionsHow to create
Series??
DataFrame??
Index??
Q29 6 Marks

For DataFrame df with 5 students predict each operation's result.

Method/attributeReturns
df.head()?
df.tail()?
df.shape?
df.columns?
df.describe()?
df.info()?
Q30 6 Marks

Match each pandas method with its purpose.

MethodPurpose
read_csv()?
dropna()?
fillna()?
groupby()?
sort_values()?
merge()?
Q31 5 Marks

Predict the result of each pandas Series operation.

Operation on s = [10, 20, 30, 40]Result
s[0]?
s.sum()?
s.mean()?
s.max()?
len(s)?
s + 5?
Q32 3 Marks

Study the pandas DataFrame structure and answer:

Data Handling using Pandas figure
  1. A 2-D labelled tabular data structure is called a:
    ASeries
    BDataFrame
    CIndex
    DList
  2. The shape of the DataFrame shown is:
    A(4, 5)
    B(5, 4)
    C(4, 4)
    D(5, 5)
  3. Discuss the structure of a pandas DataFrame and any three common attributes/methods.
Show answersHide answers
1. Option 2 — DataFrame
2. Option 1 — (4, 5)
3. A pandas DataFrame is a 2-D labelled tabular data structure with rows and columns. The leftmost is the index (0 1 2 3) and the top row is the column names. df.shape returns (rows columns); df.columns returns the column labels; df.head() shows the first 5 rows. The DataFrame can be created from CSV dictionary list of lists or another DataFrame.
Q33 3 Marks

Study the pandas Series structure and answer:

Data Handling using Pandas figure
  1. A 1-D labelled array in pandas is called a:
    ASeries
    BDataFrame
    CIndex
    DList
  2. For s = pd.Series([78, 65, 92, 84, 55]) what is s[2]?
    A78
    B65
    C92
    D55
  3. Discuss the structure and common operations of a pandas Series.
Show answersHide answers
1. Option 1 — Series
2. Option 3 — 92
3. A pandas Series is a 1-D labelled array. Each element has an integer index by default but custom labels can be assigned. Common operations include indexing (s[2]) sum() mean() max() min() len(). Series can be created from a list dictionary or NumPy array. It is the building block of a DataFrame.
Q34 3 Marks

Study the DataFrame workflow diagram and answer:

Data Handling using Pandas figure
  1. Which method loads a CSV file into a DataFrame?
    Aread_csv()
    Bopen()
    Cload()
    Dimport_csv()
  2. Which methods are commonly used in DataFrame processing?
    Adropna()
    Bfillna()
    Cgroupby()
    DAll of these
  3. Discuss the typical workflow for processing data with pandas DataFrames.
Show answersHide answers
1. Option 1 — read_csv()
2. Option 4 — All of these
3. Typical DataFrame workflow: 1) Load data from CSV using read_csv(). 2) Inspect with head() info() describe(). 3) Process: handle missing values (dropna fillna) sort (sort_values) group and aggregate (groupby) merge with other DataFrames. 4) Save using to_csv() or to_excel().

Make a full Informatics Practices paper on Data Handling using Pandas.

Pick the question mix, set the marks, hit generate. You get a ready-to-print paper with an answer key.

Generate your paper — free