Completed

DataFrame — Label Indexing & Boolean Indexing

Class 12 · Informatics Practices Thu, 8 Oct 2026 9:00 PM 60s / question 15 questions · 15 marks

Questions From This Challenge

Q1mcq1 mark
Which attribute is used to select DataFrame rows and columns by their label (not integer position)?
.loc[] ✓
.iloc[]
.at[]
.label[]
Q2mcq1 mark
Which of the following DataFrame indexing methods is explicitly NOT part of the CBSE Class 12 IP (065) syllabus?
.iloc[] ✓
.loc[]
Boolean indexing
df['column']
Q3mcq1 mark
When slicing rows with df.loc['a':'c'] on a DataFrame indexed by labels 'a', 'b', 'c', 'd', which rows are included in the result?
'a', 'b', and 'c' — the end label is included ✓
'a' and 'b' only — the end label is excluded
'a' only
'b', 'c', and 'd'
Q4mcq1 mark
What does the expression df[df['Marks'] > 50] return?
A DataFrame containing only the rows where the 'Marks' value is greater than 50 ✓
A single scalar value
A Series of True/False values only
A new DataFrame with the 'Marks' column removed
Q5mcq1 mark
Given df indexed by labels 'p1', 'p2', 'p3' with a column 'Price', which expression retrieves the single Price value for row label 'p2'?
df.loc['p2', 'Price'] ✓
df.loc['Price', 'p2']
df['p2']['Price']
df.iloc['p2', 'Price']
Q6mcq1 mark
What is the purpose of writing `mask = df['Score'] >= 45` followed by `df[mask]`?
To filter and return only the rows where 'Score' is at least 45 ✓
To create a new column named 'mask'
To sort the DataFrame by 'Score'
To count how many rows have 'Score' >= 45
Q7mcq1 mark
Given df indexed by labels 'r1', 'r2', 'r3' with columns 'A' and 'B', what does df.loc['r1'] return?
A Series containing the values of columns 'A' and 'B' for row 'r1' ✓
A DataFrame with only row 'r1'
The integer position of row 'r1'
A list of all row labels
Q8output1 mark
What is the output of the following code?
import pandas as pd
df = pd.DataFrame({'Marks': [85, 90, 78]}, index=['a', 'b', 'c'])
print(df.loc['b'])
Correct output: Marks 90 Name: b, dtype: int64
Q9output1 mark
What is the output of the following code, which slices rows using a label range?
import pandas as pd
df = pd.DataFrame({'Marks': [85, 90, 78, 60]}, index=['a', 'b', 'c', 'd'])
print(df.loc['a':'c'])
Correct output: Marks a 85 b 90 c 78
Q10output1 mark
What is the output of the following code using Boolean indexing?
import pandas as pd
df = pd.DataFrame({'Name': ['Ravi', 'Sita', 'Tara'], 'Marks': [55, 92, 40]})
print(df[df['Marks'] > 50])
Correct output: Name Marks 0 Ravi 55 1 Sita 92
Q11output1 mark
What is the output of the following code?
import pandas as pd
df = pd.DataFrame({'Price': [100, 200, 300]}, index=['p1', 'p2', 'p3'])
print(df.loc['p2', 'Price'])
Correct output: 200
Q12output1 mark
What is the output of the following code?
import pandas as pd
df = pd.DataFrame({'Qty': [5, 15, 25, 35]}, index=['w', 'x', 'y', 'z'])
print(df.loc['x':'z'])
Correct output: Qty x 15 y 25 z 35
Q13output1 mark
What is the output of the following code?
import pandas as pd
df = pd.DataFrame({'Score': [45, 78, 33, 90]})
mask = df['Score'] >= 45
print(df[mask])
Correct output: Score 0 45 1 78 3 90
Q14output1 mark
What is the output of the following code?
import pandas as pd
df = pd.DataFrame({'A': [1, 2, 3], 'B': [10, 20, 30]}, index=['r1', 'r2', 'r3'])
print(df.loc['r1'])
Correct output: A 1 B 10 Name: r1, dtype: int64
Q15output1 mark
What is the output of the following code?
import pandas as pd
df = pd.DataFrame({'Temp': [30, 35, 28, 40]}, index=['mon', 'tue', 'wed', 'thu'])
print(df[df['Temp'] > 30])
Correct output: Temp tue 35 thu 40
Next Live Challenge
Network Types
Class 12 · Informatics Practices Fri, 23 Oct 2026, 9:00 PM
View Live Challenges →

← Back to Live Challenge History · Practice MCQs

CodeBuddy
Hi there! 👋 I'm CodeBuddy, your KV Coders assistant.

To help me give you the most accurate answers, please select your class and subject below, or just type your question!
Buddy is typing...