Filters
Question type

Study Flashcards

A(n) _____ access file is also known as a direct access file.


A) sequential
B) random
C) numbered
D) text

Correct Answer

verifed

verified

Closing a file disconnects the communication between the file and the program.

Correct Answer

verifed

verified

What statement can be used to handle some of the run-time errors in a program?


A) exception statement
B) try statement
C) try/except statement
D) exception handler statement

Correct Answer

verifed

verified

C

When a piece of data is read from a file, it is copied from the file into the program.

Correct Answer

verifed

verified

The ZeroDivisionError exception is raised when the program attempts to perform a division by zero.

Correct Answer

verifed

verified

Python allows the programmer to work with text and number files.

Correct Answer

verifed

verified

A(n) _______________ includes one or more statements that can potentially raise an exception.

Correct Answer

verifed

verified

What type of file access jumps directly to any piece of data in a file without reading the data that came before it?


A) Sequential
B) Random
C) Number
D) Text

Correct Answer

verifed

verified

Strings can be written directly to a file with the write method, but numbers must be converted to strings before they can be written.

Correct Answer

verifed

verified

Which method could be used to strip specific characters from the end of a string?


A) estrip
B) rstrip
C) strip
D) remove

Correct Answer

verifed

verified

The term _______________ file is used to describe a file to which data is written.

Correct Answer

verifed

verified

output

Which method will return an empty string when it has attempted to read beyond the end of a file?


A) read
B) getline
C) input
D) readline

Correct Answer

verifed

verified

In Python, there is nothing that can be done if the program tries to access a file to read that does not exist.

Correct Answer

verifed

verified

A(n) _______________ gives information regarding the line number(s) that caused an exception.

Correct Answer

verifed

verified

A filename _______________ is a short sequence of characters that appear at the end of a filename preceded by a period.

Correct Answer

verifed

verified

extension

What happens when a piece of data is written to a file?


A) Data is copied from a variable in RAM to a file.
B) Data is copied from a variable in the program to a file.
C) Data is copied from the program to a file.
D) Data is copied from a file object to a file.

Correct Answer

verifed

verified

A(n) _______________ access file retrieves data from the beginning of the file to the end of the file.

Correct Answer

verifed

verified

The term _______________ file is used to describe a file from which the program gets data.

Correct Answer

verifed

verified

Which step creates a connection between a file and a program?


A) Open the file.
B) Read the file.
C) Process the file.
D) Close the file.

Correct Answer

verifed

verified

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_file.write('Mary Smith')
B) customer.write('w','Mary Smith')
C) customer.input('Mary Smith')
D) customer.write('Mary Smith')

Correct Answer

verifed

verified

Showing 1 - 20 of 35

Related Exams

Show Answer