Exam 6: Files and Exceptions
Exam 1: Introduction to Computers and Programming39 Questions
Exam 2: Input, Processing, and Output40 Questions
Exam 3: Decision Structures and Boolean Logic40 Questions
Exam 4: Repetition Structures41 Questions
Exam 5: Functions66 Questions
Exam 6: Files and Exceptions40 Questions
Exam 7: Lists and Tuples40 Questions
Exam 8: More About Strings37 Questions
Exam 9: Dictionaries and Sets39 Questions
Exam 10: Classes and Object-Oriented Programming38 Questions
Exam 11: Inheritance36 Questions
Exam 12: Recursion35 Questions
Exam 13: Gui Programming42 Questions
Select questions type
Python allows the programmer to work with text and number files.
Free
(True/False)
4.9/5
(43)
Correct Answer:
False
If data is retrieved from a file by a program,this is known by the term __________ file.
Free
(Short Answer)
4.9/5
(35)
Correct Answer:
input
A(n)___________ file contains data that has been encoded as text,using a scheme such as ASCII.
Free
(Short Answer)
4.8/5
(32)
Correct Answer:
text
If the last line in a file is not terminated with \n,the readline method will return the line without \n.
(True/False)
4.9/5
(36)
Which of the following is the correct way to open a file named users.txt in 'r' mode?
(Multiple Choice)
4.8/5
(43)
Which statement can be used to handle some of the runtime errors in a program?
(Multiple Choice)
4.8/5
(45)
Which of the following is the correct way to open a file named users.txt to write to it?
(Multiple Choice)
4.9/5
(36)
It is possible to create a while loop that determines when the end of a file has been reached.
(True/False)
4.9/5
(26)
What will be the output after the following code is executed and the user enters 75 and -5 at the first two prompts?


(Multiple Choice)
4.7/5
(39)
A filename __________ is a short sequence of characters that appear at the end of a filename,preceded by a period.
(Short Answer)
4.8/5
(36)
A(n)__________ gives information about the line number(s)that caused an exception.
(Short Answer)
4.8/5
(33)
Given 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
(32)
When a piece of data is read from a file,it is copied from the file into the program.
(True/False)
4.7/5
(41)
Which mode specifier will erase the contents of a file if it already exists and create the file if it does not already exist?
(Multiple Choice)
4.9/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
(39)
Which method could be used to strip specific characters from the end of a string?
(Multiple Choice)
4.8/5
(39)
A(n)___________ block includes one or more statements that can potentially raise an exception.
(Short Answer)
4.7/5
(37)
Which step creates a connection between a file and a program?
(Multiple Choice)
4.8/5
(33)
Which type of file access jumps directly to a piece of data in the file without having to read all the data that comes before it?
(Multiple Choice)
4.7/5
(34)
Showing 1 - 20 of 40
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)