What statement can be used to handle some of the run-time errors in a program?
a. try/except statement
b. exception handler statement
c. exception statement
d. try statement
Once your program finished writing to a file, it should then close the file. Otherwise -------------- could happen.
a. buffer overflow
c. file deletion
d. data appending
Which method could be used to remove specific characters from the end of a string?
When an existing file is opened, the mode erases the contents of the file.
Which method will return an empty string when it has attempted to read beyond the end of a file?
Structured data is sometimes stared as records in files. Each item within a single record is called:
Consider a try-except-famally structure. Assume that an exception occurs in try block statements, and is handled by except block. When do the statements in famally block execute?
a. Never because exception has been handled 0 After try block and before except block
b. After the exception is handled by except block 0 Before try block
c. Before try block
Assume that the customer file references a file object, and the file was opened using the 'w' mode specifier. How would you write the string 'Mary Smith'- to the file?
a. customer.write('w' , 'Mary Smith')
b. customer. input('Mary Smith' )
c. customer write('Mary Smith' )
When a program halts with an exception, it prints a Traceback. What kind of information in provided in the Traceback?
a. line number which caused exception
b. file name containing the problematic code
c. stack of function calls
d. all of the above
A--------------access file is also known as a direct access file.