Completed

Import/Export with CSV

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

Questions From This Challenge

Q1mcq1 mark
Which function is used to read the contents of a CSV file into a Pandas DataFrame?
pd.read_csv() ✓
pd.load_csv()
pd.import_csv()
pd.open_csv()
Q2mcq1 mark
Which DataFrame method is used to export a DataFrame's contents to a CSV file?
df.to_csv() ✓
df.export_csv()
df.write_csv()
df.save_csv()
Q3mcq1 mark
By default, when df.to_csv('data.csv') is called without specifying the index parameter, what happens to the DataFrame's row index?
It is written to the CSV file as an extra leading column ✓
It is always dropped from the output
It replaces the header row
It causes an error
Q4mcq1 mark
Which argument to df.to_csv() prevents the DataFrame's row index from being written to the output CSV file?
index=False ✓
header=False
drop_index=True
write_index=False
Q5mcq1 mark
Which parameter of pd.read_csv() sets a specific column from the CSV file as the resulting DataFrame's row index?
index_col ✓
set_index
row_label
use_index
Q6mcq1 mark
What type of object does pd.read_csv() return when reading a valid CSV file?
A DataFrame ✓
A Series
A NumPy array
A Python list
Q7mcq1 mark
What happens when df.to_csv() is called with no filename/path argument at all?
It returns the CSV-formatted content as a string ✓
It raises a mandatory-argument error
It writes to a file named 'output.csv' automatically
It prints the DataFrame in its normal tabular display format
Q8mcq1 mark
Which statement must appear before using pd.read_csv() or df.to_csv() in a Python program?
import pandas as pd ✓
import csv as pd
from csv import pandas
include pandas
Q9mcq1 mark
By default, which character does pd.read_csv() use to separate values in each row of the file?
Comma (,) ✓
Semicolon (;)
Tab
Pipe (|)
Q10output1 mark
What is the output of the following code, which converts a DataFrame to CSV text without writing to a file?
import pandas as pd
df = pd.DataFrame({'Name': ['Anu', 'Bala'], 'Age': [20, 22]})
print(df.to_csv(index=False))
Correct output: Name,Age Anu,20 Bala,22
Q11output1 mark
What is the output of the following code, which converts a DataFrame to CSV text using the default index setting?
import pandas as pd
df = pd.DataFrame({'City': ['Delhi', 'Agra']})
print(df.to_csv())
Correct output: ,City 0,Delhi 1,Agra
Q12output1 mark
Assume a file marks.csv already exists in the working directory with exactly this content: Name,Marks Ram,85 Shyam,90 What is the output of the following code?
import pandas as pd
df = pd.read_csv('marks.csv')
print(df)
Correct output: Name Marks 0 Ram 85 1 Shyam 90
Q13output1 mark
Assume a file scores.csv already exists in the working directory with exactly this content: ID,Name,Score 1,Ravi,70 2,Meena,80 What is the output of the following code?
import pandas as pd
df = pd.read_csv('scores.csv', index_col='ID')
print(df)
Correct output: Name Score ID 1 Ravi 70 2 Meena 80
Q14output1 mark
Assume a file items.csv already exists in the working directory with exactly this content: Item,Price Pen,10 Book,50 Bag,200 Cup,30 What is the output of the following code?
import pandas as pd
df = pd.read_csv('items.csv')
print(df.head(2))
Correct output: Item Price 0 Pen 10 1 Book 50
Q15output1 mark
Assume a file grid.csv already exists in the working directory with exactly this content: A,B,C 1,2,3 4,5,6 7,8,9 What is the output of the following code?
import pandas as pd
df = pd.read_csv('grid.csv')
print(df.shape)
Correct output: (3, 3)
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...