Chapter 13: Python and CSV Files — Online MCQ Test
COMPUTER SCIENCE · CLASS 12th · Tamil Nadu State Board
Practice Chapter 13: Python and CSV Files with a free chapter-wise online MCQ test.
This chapter covers: This chapter bridges Python programming with external tabular storage using the built-in CSV module. It details reading writing and appending comma-separated data along with custom....
AI-generated questions from basic to board-exam level, with instant results and explanations.
Chapter 13: Python and CSV Files — Important Questions & Answers
Which Python module is used to read and write CSV files?
- A. csv
- B. file
- C. tabular
- D. data
Answer: A. csv
The built-in csv module provides functions and classes to work with comma-separated values files.
The built-in csv module provides functions and classes to work with comma-separated values files.
What does CSV stand for?
- A. Comma Separated Values
- B. Common Standard Values
- C. Computer Stored Values
- D. Comma Storage Vector
Answer: A. Comma Separated Values
CSV is a text format where values are separated by commas or other delimiters.
CSV is a text format where values are separated by commas or other delimiters.
What does the writerow() method do in the csv module?
- A. Reads one row from a CSV file
- B. Writes a single row to a CSV file
- C. Deletes a row from a CSV file
- D. Counts rows in a CSV file
Answer: B. Writes a single row to a CSV file
writerow() is used with a csv writer object to write one row of data at a time.
writerow() is used with a csv writer object to write one row of data at a time.
Which statement is NOT correct about CSV files?
- A. They store tabular data
- B. They can be opened using a text editor
- C. They always use only commas and no other delimiters
- D. They are plain text files
Answer: C. They always use only commas and no other delimiters
CSV files may use different delimiters such as semicolon, tab, or pipe depending on the format.
CSV files may use different delimiters such as semicolon, tab, or pipe depending on the format.
Which of the following is the correct way to create a CSV writer object for a file object f?
- A. csv.reader(f)
- B. csv.writer(f)
- C. csv.write(f)
- D. csv.DictReader(f)
Answer: B. csv.writer(f)
csv.writer(f) returns a writer object that can write rows into the file.
csv.writer(f) returns a writer object that can write rows into the file.