CUET-UG SERIES Computer-science
Pandas
7 previous year questions.
Volume: 7 Ques
Yield: Medium
High-Yield Trend
6
2025 1
2023 Chapter Questions 7 MCQs
01
PYQ 2023
medium
computer-science ID: cuet-ug-
The way a dataset is arranged into rows and columns is referred to as the shape of data. Following function is used to reshape and create a new DataFrame from the original one:
1
dropna()
2
pivot()
3
sort()
4
merge()
\textbf{Correct Answer:} (2) pivot()
\textbf{Correct Answer:} (2) pivot()
02
PYQ 2025
medium
computer-science ID: cuet-ug-
Which of the following are the correct commands to delete a column from the DataFrame df1?
1
df1 = df1.drop(column_name, axis=1)
2
df1.drop(column_name, axis=columns, inplace=True)
3
df1.drop(column_name, axis='columns', inplace=True)
4
df1.drop(column_name, axis=1, inplace=True)
03
PYQ 2025
medium
computer-science ID: cuet-ug-
Which of the following is the correct command to display the top 2 records of Series \texttt{tail}?
1
print(s1.head(2))
2
print(tail.head())
3
print(tail.head(0))
4
print(tail.head(2))
04
PYQ 2025
medium
computer-science ID: cuet-ug-
Consider the given DataFrame df4:
| NAME | PERIODIC | ENG | MATHS | SCIENCE |
|---|---|---|---|---|
| MEENA | 1 | 40 | 60 | 80 |
| REENA | 2 | 60 | 30 | 10 |
| TEENA | 3 | 80 | 60 | 40 |
| SHEENA | 2 | 90 | 20 | 70 |
We want the following output:
| NAME | MEENAREENATEENASHEENA |
|---|---|
| PERIODIC | 8 |
| ENG | 270 |
| MATHS | 170 |
| SCIENCE | 200 |
1
print(df4.sum(numeric_only=True))
2
print(df4.sum(numeric_only=False))
3
print(df4.sum())
4
print(df4.count(numeric_only=True))
05
PYQ 2025
medium
computer-science ID: cuet-ug-
Given the following DataFrame df:
| PNO | NAME |
|---|---|
| 111 | ROHAN |
| 222 | MEETA |
| 333 | SEEMA |
| 444 | SHALU |
| 555 | POONAM |
Select the correct commands from the following to display the last five rows:
1
print(df.tail(-5))
2
print(df.head(-5))
3
print(df.tail())
4
print(df.tail(5))
06
PYQ 2025
medium
computer-science ID: cuet-ug-
The process of changing the structure of a DataFrame using function pivot() is known as .............
1
Transpose
2
Reindexing
3
Resetting
4
Reshaping
07
PYQ 2025
medium
computer-science ID: cuet-ug-
Given the following series ser1:
| Index | Value |
|---|---|
| 0 | 69 |
| 1 | 80 |
| 2 | 20 |
| 3 | 50 |
| 4 | 100 |
| 5 | 70 |
State the output of the following command:
print(ser1 >= 70)
1
| Index | Value |
|---|---|
| 1 | 80 |
| 4 | 100 |
| 5 | 70 |
2
| Index | Result |
|---|---|
| 0 | F |
| 1 | T |
| 2 | F |
| 3 | F |
| 4 | T |
| 5 | T |
3
| Index | Condition |
|---|---|
| 1 | T |
| 4 | T |
| 5 | T |
4
| Index | Value |
|---|---|
| 1 | 80 |
| 4 | 100 |