Topic: Chapter 13: Python and CSV files (Test 1)



Topic: Chapter 13: Python and CSV files
  • «
  • Test: 1(current)
  • «
Q.1
The command used to skip a row in a CSV file is
A. next()
B. skip()
C. omit()
D. bounce()
Answer : Option A
Explaination / Solution:
No Explaination.


Workspace
Report
Q.2
Which of the following is a string used to terminate lines produced by writer()method of csv module?
A. Line Terminator
B. Enter key
C. Form feed
D. Data Terminator
Answer : Option A
Explaination / Solution:
No Explaination.


Workspace
Report
Q.3

What is the output of the following program? import csv d=csv.reader(open('c:\PYPRG\ch13\city.csv'))

next(d)

for row in d: print(row)

if the file called “city.csv” contain the following details

chennai,mylapore

mumbai,andheri

A. chennai,mylapore
B. mumbai,andheri
C. chennai
mumbai
D. chennai,mylapore
mumbai, andheri

Answer : Option B
Explaination / Solution:
No Explaination.


Workspace
Report
Q.4
Which of the following creates an object which maps data to a dictionary?
A. listreader()
B. reader()
C. tuplereader()
D. DicReader ()
Answer : Option D
Explaination / Solution:
No Explaination.


Workspace
Report
Q.5
Making some changes in the data of the existing file or adding more data is called
A. Editing
B. Appending
C. Modification
D. Alteration
Answer : Option C
Explaination / Solution:
No Explaination.


Workspace
Report
Q.6

What will be written inside the file test.csv using the following program import csv

D = [['Exam'],['Quarterly'],['Halfyearly']]

csv.register_dialect('M',lineterminator = '\n')

with open('c:\pyprg\ch13\line2.csv', 'w') as f:

wr = csv.writer(f,dialect='M')

wr.writerows(D)

f.close()

A. Exam, Quarterly, Halfyearly
B. Exam Quarterly Halfyearly
C. E
Q
H
D. Exam,
Quarterly,
Halfyearly
Answer : Option D
Explaination / Solution:
No Explaination.


Workspace
Report
Q.7
A CSV file is also known as a ….
A. Flat File
B. 3D File
C. String File
D. Random File
Answer : Option A
Explaination / Solution:
No Explaination.


Workspace
Report
Q.8
The expansion of CRLF is
A. Control Return and Line Feed
B. Carriage Return and Form Feed
C. Control Router and Line Feed
D. Carriage Return and Line Feed
Answer : Option D
Explaination / Solution:
No Explaination.


Workspace
Report
Q.9
Which of the following module is provided by Python to do several operations on the CSV files?
A. py
B. xls
C. csv
D. os
Answer : Option C
Explaination / Solution:
No Explaination.


Workspace
Report
Q.10
Which of the following mode is used when dealing with non-text files like image or exe files?
A. Text mode
B. Binary mode
C. xls mode
D. csv mode
Answer : Option B
Explaination / Solution:
No Explaination.


Workspace
Report


  • «
  • Test: 1(current)
  • «