0% found this document useful (0 votes)
23 views2 pages

CSV File 28

The document contains a series of questions related to Python's file handling and CSV module functionalities. It includes questions about the syntax of the seek function, default delimiters in CSV files, and the importance of the newline parameter when opening files. Additionally, it presents a scenario involving a programmer needing assistance with creating and managing a CSV file.

Uploaded by

prachigautam0912
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views2 pages

CSV File 28

The document contains a series of questions related to Python's file handling and CSV module functionalities. It includes questions about the syntax of the seek function, default delimiters in CSV files, and the importance of the newline parameter when opening files. Additionally, it presents a scenario involving a programmer needing assistance with creating and managing a CSV file.

Uploaded by

prachigautam0912
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

CSV FILE 28/11/2023

1. Syntax of seek function in Python is myfile.seek(offset, reference_point) where myfile is the file object.
What is the default value of reference_point?
a) 0 b) 1 c) 2 d) 3

2. Which of the following character acts as default delimiter in a csv file?


a) (colon) : b) (hyphen) - c) (comma) , d) (vertical line) |
3. Syntax for opening a Student.csv file in write mode is myfile = open("Student.csv","w",newline=''). What
is the importance of newline=''?
a) A newline gets added to the file
b) Empty string gets appended to the first line.
c) Empty string gets appended to all lines.
d) EOL translation is suppressed
4. Which of the following is not a function / method of csv module in Python?
a) read() b) reader() c) writer() d) writerow()
5. Which of the following functions changes the position of file pointer and returns its new position?
a) flush() b) tell() c) seek() d) offset()
6. Mr. Manish Kumar is writing a program to create a CSV file “user.csv” which will contain user name and
password for some entries. He has written the following code. As a programmer, help him to
successfully execute the given task.

a) Name the module he should import in Line 1.


b) In which mode, Manish should open the file to add data into the file
c) Fill in the blank in Line 3 to read the data from a csv file.
d) Fill in the blank in Line 4 to close the file.
e) Write the output he will obtain while executing Line 5.
(a) Name the module he should import in Line 1.
(b) In which mode, Ranjan should open the file to add data into the file in line 2.
(c) Fill in the blank in Line 3 to read the data from a csv file.
(d) Fill in the blank in Line 4 to close the file.
(e) Write the output he will obtain while executing Line 5.

You might also like