Exam 7: files and Exceptions
Exam 1: Introduction to Computers and Programming35 Questions
Exam 2: Input, Processing, and Output35 Questions
Exam 3: Simple functions34 Questions
Exam 4: Decision Structures and Boolean Logic35 Questions
Exam 5: Repetition Structures35 Questions
Exam 6: Value-Returning functions and Modules35 Questions
Exam 7: files and Exceptions35 Questions
Exam 8: Lists and Tuples35 Questions
Exam 9: More About Strings35 Questions
Exam 10: Dictionaries and Sets35 Questions
Exam 11: Classes and Object-Oriented Programming35 Questions
Exam 12: Inheritance35 Questions
Exam 13: Recursion35 Questions
Exam 14: GUI Programming35 Questions
Select questions type
A filename _______________ is a short sequence of characters that appear at the end of a filename preceded by a period.
Free
(Short Answer)
4.8/5
(38)
Correct Answer:
extension
What statement can be used to handle some of the run-time errors in a program?
Free
(Multiple Choice)
4.9/5
(47)
Correct Answer:
C
The term _______________ file is used to describe a file to which data is written.
Free
(Short Answer)
4.9/5
(37)
Correct Answer:
output
The ZeroDivisionError exception is raised when the program attempts to perform a division by zero.
(True/False)
4.8/5
(43)
The term _______________ file is used to describe a file from which the program gets data.
(Short Answer)
4.8/5
(38)
Which method will return an empty string when it has attempted to read beyond the end of a file?
(Multiple Choice)
4.9/5
(46)
Strings can be written directly to a file with the write method, but numbers must be converted to strings before they can be written.
(True/False)
4.8/5
(44)
A(n) _______________ access file retrieves data from the beginning of the file to the end of the file.
(Short Answer)
4.9/5
(35)
A(n) _______________ gives information regarding the line number(s) that caused an exception.
(Short Answer)
4.9/5
(47)
Python allows the programmer to work with text and number files.
(True/False)
4.8/5
(36)
A(n) _____ access file is also known as a direct access file.
(Multiple Choice)
4.9/5
(32)
What type of file access jumps directly to any piece of data in a file without reading the data that came before it?
(Multiple Choice)
5.0/5
(29)
A(n) _______________ includes one or more statements that can potentially raise an exception.
(Short Answer)
4.8/5
(42)
When a piece of data is read from a file, it is copied from the file into the program.
(True/False)
4.9/5
(37)
Which step creates a connection between a file and a program?
(Multiple Choice)
4.8/5
(40)
Which method could be used to strip specific characters from the end of a string?
(Multiple Choice)
4.7/5
(35)
Closing a file disconnects the communication between the file and the program.
(True/False)
4.8/5
(36)
In Python, there is nothing that can be done if the program tries to access a file to read that does not exist.
(True/False)
4.9/5
(35)
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?
(Multiple Choice)
4.8/5
(44)
Showing 1 - 20 of 35
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)