Test Index
File Handling in Python
© examsnet.com
Question : 18 of 37
Marks:
+1,
-0
Q. 17 and 18 are ASSERTION (A) and REASONING (R) based questions. Mark the correct choice as :Assertion (A) : CSV file is a human readable text file where each line has a number of fields, separated by comma or some other delimiter.Reason (R) :
writerow() method is used to write a single row in a CSV file.[CBSE 2024 Set 4]
Solution:
Assertion (A): True. A CSV (Comma Separated Values) file is a plain text file that people can read; each line is a record whose fields are separated by a comma or another delimiter.Reason (R): True.
csv.writer(f).writerow(row) writes one row (one record) to a CSV file; writerows() writes many rows.Explanation:R is about a method that writes to the file; it does not explain why a CSV file is human readable or how its fields are separated. So both are true, but R is not the correct explanation of A.Answer:Option B (Both (A) and (R) are true and (R) is not the correct explanation for (A).)© examsnet.com
Go to Question: