Exam 6: Files and Exceptions

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

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

Free
(True/False)
4.9/5
(43)
Correct Answer:
Verified

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:
Verified

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:
Verified

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)

What is the process of retrieving data from a file called?

(Multiple Choice)
4.8/5
(40)

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? 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
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)