PART 2 PANDAS SERIES QUESTION BASE ON REASONING- ASSERTION

 ðŸ§  ASSERTION–REASON QUESTIONS (Q101–Q110)

Directions:
Choose the correct option:
A. Both A and R are true, and R is the correct explanation of A
B. Both A and R are true, but R is not the correct explanation of A
C. A is true, R is false
D. A is false, R is true


Q101

Assertion (A): Pandas Series can store data of different data types.
Reason (R): Pandas Series is built on NumPy array.

Ans: A


Q102

A: A Pandas Series is mutable.
R: Values of a Series can be changed after creation.

Ans: A


Q103

A: dropna() removes missing values from a Series.
R: Missing values are represented by NaN in Pandas.

Ans: A


Q104

A: s.size and s.count() always return the same value.
R: s.count() ignores NaN values.

Ans: D


Q105

A: iloc[] uses integer-based indexing.
R: iloc[] uses labels for indexing.

Ans: C


Q106

A: loc[] can use string labels.
R: loc[] is label-based indexing.

Ans: A


Q107

A: fillna() replaces missing values in a Series.
R: Missing values cannot be replaced in Pandas.

Ans: C


Q108

A: Arithmetic operations in Series are vectorized.
R: Operations are applied element-wise.

Ans: A


Q109

A: value_counts() returns frequency of unique values.
R: It sorts the output in descending order by default.

Ans: B


Q110

A: astype() is used to change data type of Series.
R: Data type of Series cannot be modified.

Ans: C


🧪 OUTPUT-BASED QUESTIONS (Q111–Q120)

Q111

import pandas as pd s = pd.Series([10, 20, 30]) print(s + 5)

Output:

0 15 1 25 2 35 dtype: int64

Q112

s = pd.Series([1, 2, None, 4]) print(s.count())

Output: 3


Q113

s = pd.Series([5, 10, 15], index=['a','b','c']) print(s.loc['b'])

Output: 10


Q114

s = pd.Series([10, 20, 30]) print(s.iloc[0])

Output: 10


Q115

s = pd.Series([2, 4, 6]) print(s.mean())

Output: 4.0


Q116

s = pd.Series([1, 1, 2, 3]) print(s.unique())

Output:

[1 2 3]

Q117

s = pd.Series([10, 20, 30]) print(s.idxmax())

Output: 2


Q118

s = pd.Series([5, 10, 15]) print(s.tail(2))

Output:

1 10 2 15 dtype: int64

Q119

s = pd.Series([1, 2, 3]) print(s.cumsum())

Output:

0 1 1 3 2 6 dtype: int64

Q120

s = pd.Series([10, 20, 30]) print(s > 15)

Output:

0 False 1 True 2 True dtype: bool

📘 CASE-STUDY QUESTIONS (Q121–Q125)

Case Study

A teacher stores marks of students in a Pandas Series.

marks = pd.Series([78, 85, None, 90, 85])

Q121. How many valid marks are present?

Ans: 4


Q122. Which function will remove missing marks?

Ans: dropna()


Q123. Which function will replace missing marks with 0?

Ans: fillna(0)


Q124. Which function gives average marks?

Ans: mean()


Q125. Which function shows frequency of marks?

Ans: value_counts()

Post a Comment

Please do note create link post in comment section

Previous Post Next Post