Question: python questions QUESTION 1 A ( n ) _ _ _ _ _ _ _ _ block includes one or more statements that can potentially

python questions
QUESTION 1
A(n)________ block includes one or more statements that can potentially raise an exception.
10 points
QUESTION 2
What is the process of retrieving data from a file called?
reading input
getting data
reading data
retrieving data
10 points
QUESTION 3
What is one important advantage of using a with statement to access files?
After the with suite, the file or files referenced in the with header are automatically closed.
The with statement provides automatic text filtering and reduces processing time.
The with statement will catch when a file is not present.
The with statement provides options for processing data records.
10 points
QUESTION 4
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
5 points
QUESTION 5
Which mode specifier will open a file but not let you change the file or write to it?
'r'
'a'
'e'
'w'
10 points
QUESTION 6
An exception handler is a piece of code that is written using the try/except statement.
True
False
5 points
QUESTION 7
Closing a file disconnects the communication between the file and the program.
True
False
5 points
QUESTION 8
Which step creates a connection between a file and a program?
read the file
open the file
process the file
close the file
10 points
QUESTION 9
If a file with the specified name already exists when the file is opened and the file is opened in 'w' mode, then an alert will appear on the screen.
True
False
5 points
QUESTION 10
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?
customer.write('Mary Smith')
customer.write('w', 'Mary Smith')
customer.input('Mary Smith')
customer file.write('Mary Smith')
10 points
QUESTION 11
Which method could be used to convert a numeric value to a string?
value
chr
num
str
10 points
QUESTION 12
Which of the following is the correct way to open a file named users.txt to write to it?
outfile = open('users.txt')
outfile = write('users.txt','w')
outfile = open('w', users.txt)
outfile = open('users.txt','w')

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!