File Handling — Chapter Test

Answer all 5 questions, then submit. You need 60% to pass. Log in to save progress.

Question 1
Which file mode ERASES the file's existing contents?
Ar
Ba
Cw
Dr+
Question 2
What is the main advantage of the with statement for files?
AIt reads faster
BIt closes the file automatically, even if an error occurs
CIt encrypts the file
DIt is required for writing
Question 3
Which pickle function WRITES (serialises) an object to a binary file?
Apickle.load()
Bpickle.dump()
Cpickle.read()
Dpickle.write()
Question 4
Reading a CSV with csv.reader gives each row as a…
AString
BList of strings
CDictionary
DTuple of numbers
Question 5
Which mode opens a binary file for reading?
Ar
Brb
Cw
Dwb