CSV File Handling in Python Reading and Writing CSV Files MCQs Set 01

Multiple Choice Questions (MCQs) for Computer Science: Python Programming

Access targeted multiple-choice questions for Python Programming designed to align with the latest NCERT academic syllabus for Computer Science. These objective practice sets help students evaluate their conceptual understanding and improve exam readiness.

Practice Python Programming MCQs for Computer Science

Navigate directly to the 50 objective questions for Python Programming using the digital viewer below. Each practice set includes verified answer keys, allowing students to instantly cross-check their work and identify areas requiring further revision.

Twenty five multiple choice questions with answers on Python's csv module: what CSV files are, their features, creating them, and using reader, writer, writerow, writerows, delimiters, DictWriter and DictReader. Each question has a step-wise explanation and a teacher's note.

Question 1: What does CSV stand for?
(a) Character Separated Variables
(b) Comma Separated Values
(c) Column Sorted Values
(d) Comma Style Variables
Show Answer & Explanation

Answer: (b) Comma Separated Values

Explanation:
1. CSV is the short form of Comma Separated Values.
2. The comma separates each data value in a line.

Teacher's Note:
1. Remember: C = Comma, S = Separated, V = Values.
2. It is a plain text format.

Question 2: A CSV file is a type of
(a) database server
(b) binary image file
(c) compiled program
(d) plain text file
Show Answer & Explanation

Answer: (d) plain text file

Explanation:
1. CSV stores tabular data as plain text, so it contains only text.
2. It can be opened in Notepad.

Teacher's Note:
1. Plain text means no formatting or binary data.
2. That is why it opens in any editor.

Question 3: Which file extension must be used to save a CSV file?
(a) .csv
(b) .txt
(c) .xls
(d) .dat
Show Answer & Explanation

Answer: (a) .csv

Explanation:
1. A CSV file must be saved with the .csv extension.
2. Other extensions describe different formats.

Teacher's Note:
1. Always type name.csv while saving.
2. Excel files use .xlsx.

Question 4: In a CSV file, each record is normally stored
(a) in a separate column only
(b) in a separate file
(c) on a separate line
(d) inside quotes only
Show Answer & Explanation

Answer: (c) on a separate line

Explanation:
1. One line of the file holds one record.
2. The fields of that record are separated by commas.

Teacher's Note:
1. One line = one record.
2. Fields are separated by commas.

Question 5: Which of the following is an advantage of CSV files?
(a) It stores binary data in a standard way
(b) It is human readable and easy to edit
(c) It has a universal standard
(d) It distinguishes NULL from quotes
Show Answer & Explanation

Answer: (b) It is human readable and easy to edit

Explanation:
1. CSV is plain text so people can read and edit it easily.
2. The other options are listed as disadvantages.

Teacher's Note:
1. Advantages: simple, small, fast, readable.
2. Disadvantages: no binary data, no universal standard.

Question 6: Which of the following is a disadvantage of CSV files?
(a) Processed by almost all applications
(b) Easy to generate
(c) Lack of universal standard
(d) Simple to parse
Show Answer & Explanation

Answer: (c) Lack of universal standard

Explanation:
1. CSV has no single universal standard for all details.
2. The other options are advantages.

Teacher's Note:
1. Disadvantages include poor support of special characters.
2. Binary and control characters have no standard way.

Question 7: A field containing a comma inside it should be
(a) enclosed in double quotes
(b) written in capital letters
(c) skipped
(d) enclosed in square brackets
Show Answer & Explanation

Answer: (a) enclosed in double quotes

Explanation:
1. Double quotes tell the reader that the comma belongs to the data.
2. Without quotes the comma would split the field.

Teacher's Note:
1. Quote fields with commas, quotes or line breaks.
2. A quote inside a field is written as two quotes.

Question 8: Which of the following is NOT a way to create a CSV file?
(a) Using a spreadsheet
(b) Using a text editor such as Notepad
(c) Using a Python program
(d) Using a compiler only
Show Answer & Explanation

Answer: (d) Using a compiler only

Explanation:
1. A CSV file can be made with a spreadsheet, a text editor or Python.
2. A compiler is not a way to create CSV data.

Teacher's Note:
1. Three methods: spreadsheet, text editor, Python.
2. Spreadsheets use Save As and the CSV type.

Question 9: Which statement is used to make the csv module available in a Python program?
(a) include csv
(b) import csv
(c) use csv
(d) open csv
Show Answer & Explanation

Answer: (b) import csv

Explanation:
1. Modules in Python are loaded with the import statement.
2. So import csv is correct.

Teacher's Note:
1. Import first, then call csv.reader or csv.writer.
2. Python has no include keyword.

Question 10: Which function is used to open a file in Python?
(a) open()
(b) file()
(c) read_file()
(d) load()
Show Answer & Explanation

Answer: (a) open()

Explanation:
1. The built-in open() returns a file object.
2. That file object is then passed to csv.reader() or csv.writer().

Teacher's Note:
1. open(name, mode) returns a file object.
2. Close it with close() or use with.

Question 11: Which csv function is used to write data to a CSV file?
(a) csv.read()
(b) csv.reader()
(c) csv.writer()
(d) csv.print()
Show Answer & Explanation

Answer: (c) csv.writer()

Explanation:
1. csv.writer() returns a writer object that writes rows.
2. csv.reader() is for reading.

Teacher's Note:
1. writer = write, reader = read.
2. Both take a file object.

Question 12: Which csv function returns an iterable object used to read the rows of a CSV file?
(a) csv.QUOTE_ALL
(b) csv.writer()
(c) csv.DictWriter()
(d) csv.reader()
Show Answer & Explanation

Answer: (d) csv.reader()

Explanation:
1. csv.reader() returns a reader object that can be used in a for loop.
2. Each row comes as a list of strings.

Teacher's Note:
1. for row in reader: gives one row at a time.
2. Each row is a list.

Question 13: Which method of a writer object writes a single row?
(a) writerows()
(b) writerow()
(c) write_all()
(d) putrow()
Show Answer & Explanation

Answer: (b) writerow()

Explanation:
1. writerow(row) writes one row, given as a sequence.
2. writerows() is for many rows.

Teacher's Note:
1. row (singular) = one row.
2. rows (plural) = many rows.

Question 14: Which method of a writer object writes many rows at once from a list of lists?
(a) writerows()
(b) writerow()
(c) writeall()
(d) writelines()
Show Answer & Explanation

Answer: (a) writerows()

Explanation:
1. writerows(rows) takes a sequence of rows and writes all of them.
2. writerow() writes only one row.

Teacher's Note:
1. Plural name, plural job.
2. Pass a 2-dimensional list.

Question 15: What is the default dialect used by the csv module?
(a) text
(b) unix
(c) word
(d) excel
Show Answer & Explanation

Answer: (d) excel

Explanation:
1. By default the csv module uses the same format as Microsoft Excel.
2. A dialect is a set of formatting rules.

Teacher's Note:
1. Default dialect = excel.
2. fmtparam customizes it.

Question 16: Which parameter is passed to csv.writer() to separate fields with a tab character?
(a) sep='\t'
(b) separator='tab'
(c) delimiter='\t'
(d) tab=True
Show Answer & Explanation

Answer: (c) delimiter='\t'

Explanation:
1. The keyword delimiter sets the separator, and '\t' stands for a tab.
2. The other names are not accepted by the module.

Teacher's Note:
1. delimiter changes the separator.
2. Use the same delimiter while reading the file.

Question 17: A tab separated file is read correctly with
(a) csv.reader(f, delimiter='\t')
(b) csv.reader(f)
(c) csv.reader(f, tab=1)
(d) csv.read(f, '\t')
Show Answer & Explanation

Answer: (a) csv.reader(f, delimiter='\t')

Explanation:
1. The default reader expects commas, so the delimiter must be given.
2. The delimiter keyword gives '\t'.

Teacher's Note:
1. Match the delimiter to the file.
2. Otherwise each row stays as a single item.

Question 18: What does each row of a file read by csv.reader() look like?
(a) A dictionary
(b) A list of strings
(c) A single integer
(d) A tuple of integers
Show Answer & Explanation

Answer: (b) A list of strings

Explanation:
1. Each row is returned as a list of strings.
2. Even numbers come as strings, such as '1'.

Teacher's Note:
1. Reader rows are lists.
2. Convert with int() when needed.

Question 19: What is the data type of the value 1 read from a CSV file using csv.reader()?
(a) bool
(b) int
(c) float
(d) str
Show Answer & Explanation

Answer: (d) str

Explanation:
1. Everything read from a CSV file is text, so '1' is a string.
2. It must be converted with int() to use as a number.

Teacher's Note:
1. CSV has no data types.
2. Convert yourself.

Question 20: Which class writes dictionaries to a CSV file?
(a) csv.writerdict
(b) csv.DictReader
(c) csv.DictWriter
(d) csv.Dict
Show Answer & Explanation

Answer: (c) csv.DictWriter

Explanation:
1. DictWriter writes rows given as dictionaries.
2. DictReader reads rows into dictionaries.

Teacher's Note:
1. DictWriter = dictionary to file.
2. It needs fieldnames.

Question 21: In csv.DictWriter(file, fieldnames), the argument fieldnames is
(a) the name of the file
(b) a list of column headers giving the order of data
(c) the delimiter
(d) a dictionary of values
Show Answer & Explanation

Answer: (b) a list of column headers giving the order of data

Explanation:
1. fieldnames is a list of the column headings.
2. It decides the order in which the data is written.

Teacher's Note:
1. fieldnames = column headings.
2. Call writeheader() to write them.

Question 22: Which DictWriter method writes the header row of field names?
(a) header()
(b) writerow()
(c) writefields()
(d) writeheader()
Show Answer & Explanation

Answer: (d) writeheader()

Explanation:
1. writeheader() writes the fieldnames as the first row.
2. writerow() then writes the dictionaries.

Teacher's Note:
1. First header, then rows.
2. Only DictWriter has writeheader().

Question 23: When a CSV file is read using csv.DictReader, the dictionary keys are taken from
(a) the first row of the file
(b) the last row of the file
(c) the file name
(d) the delimiter
Show Answer & Explanation

Answer: (a) the first row of the file

Explanation:
1. The first row holds the column headings, and they become the keys.
2. The other rows give the values.

Teacher's Note:
1. First row = keys.
2. Rest of rows = values.

Question 24: From which Python version does csv.DictReader() return an ordinary dictionary for each row instead of an OrderedDict?
(a) 3.0
(b) 2.7
(c) 3.8
(d) 3.2
Show Answer & Explanation

Answer: (c) 3.8

Explanation:
1. The note in the chapter says that from Python 3.8 each row is a normal dictionary.
2. Earlier versions returned OrderedDict, so dict() was used.

Teacher's Note:
1. Python 3.8 and later: no need for dict().
2. Older versions: use dict(r).

Question 25: Which csv constant makes the writer quote every field regardless of its type?
(a) csv.QUOTE_NONNUMERIC
(b) csv.QUOTE_NONE
(c) csv.QUOTE_MINIMAL
(d) csv.QUOTE_ALL
Show Answer & Explanation

Answer: (d) csv.QUOTE_ALL

Explanation:
1. QUOTE_ALL quotes everything.
2. QUOTE_NONE quotes nothing, QUOTE_MINIMAL quotes only fields with special characters and QUOTE_NONNUMERIC quotes non-number fields.

Teacher's Note:
1. ALL = everything, NONE = nothing.
2. MINIMAL = only when needed.

Multiple Choice Questions (MCQs) for Computer Science Python Programming

Chapter MCQs with Answers for Computer Science

Review structured objective questions for Computer Science Python Programming. Built according to official NCERT guidelines, these MCQ sets support daily revision and core concept reinforcement.

Expert Practice Material for Computer Science

Cross-reference your completed choices with comprehensive NCERT solutions for Computer Science to ensure absolute clarity across all sub-topics in this chapter.

Complete Your Chapter Revision

Follow up your worksheet practice by attempting the interactive online Computer Science MCQ test for this chapter to evaluate your execution speed. All platform resources are free to access.

FAQs

Where can I access latest CSV File Handling in Python Reading and Writing CSV Files MCQs Set 01?

You can get most exhaustive CSV File Handling in Python Reading and Writing CSV Files MCQs Set 01 for free on StudiesToday.com. These MCQs for Computer Science are updated for the 2026-27 academic session as per examination standards.

Are Assertion-Reasoning and Case-Study MCQs included in the Computer Science [current-page:node:field_class] material?

Yes, our CSV File Handling in Python Reading and Writing CSV Files MCQs Set 01 include the latest type of questions, such as Assertion-Reasoning and Case-based MCQs. 50% of the paper is now competency-based.

How do practicing Computer Science MCQs help in scoring full marks in [current-page:node:field_class] exams?

By solving our CSV File Handling in Python Reading and Writing CSV Files MCQs Set 01, students can improve their accuracy and speed which is important as objective questions provide a chance to secure 100% marks in the Computer Science.

Do you provide answers and explanations for CSV File Handling in Python Reading and Writing CSV Files MCQs Set 01?

Yes, Computer Science MCQs for have answer key and brief explanations to help students understand logic behind the correct option as its important for 2026 competency-focused exams.

Can I practice these Computer Science [current-page:node:field_class] MCQs online?

Yes, you can also access online interactive tests for CSV File Handling in Python Reading and Writing CSV Files MCQs Set 01 on StudiesToday.com as they provide instant answers and score to help you track your progress in Computer Science.