When a file has been opened using the r mode specifier

Get answer to your question and much more

14.Which statement can be used to handle some of the runtime errors in a program?a.anexceptionstatementb.atrystatementc.atry/exceptstatementd.anexception handlerstatementANS: C

15.Given that thecustomerfile references a file object, and the file was opened using the'w'modespecifier, how would you write the string'Mary Smith'to the file?

Get answer to your question and much more

16.When a file has been opened using the'r'mode specifier, which method will return the file'scontents as a string?

Get answer to your question and much more

17.Which of the following is the correct way to open a file namedusers.txtin'r'mode?

Get answer to your question and much more

18.Which of the following is the correct way to open a file namedusers.txtto write to it?a.outfile = open['w', users.txt]b.outfile = write['users.txt', 'w']c.outfile = open['users.txt', 'w']d.outfile = open['users.txt']ANS: C

19.What will be the output after the following code is executed and the user enters75and0at the firsttwo prompts?def main[]:

  • School Australian National University
  • Course Title COMP 6730
  • Type

    Test Prep

  • Pages 11
  • Ratings 71% [14] 10 out of 14 people found this document helpful

This preview shows page 1 - 4 out of 11 pages.

Chapter SevenMULTIPLECHOICE1.Which of these is associated with a specific file and provides a way for the program to work withthat file?a. Filenameb. Extensionc. File objectd. File variable

2.What do you call the process of retrieving data from a file?

Get answer to your question and much more

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

Get answer to your question and much more

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

Get answer to your question and much more

5.How many types of files are there?a. Oneb. Twoc. Threed. Four

6.A[n] _____ access file is also known as a direct access file.

Get answer to your question and much more

7.What type of file access jumps directly to any piece of data in a file without reading the data thatcame before it?

Get answer to your question and much more

8.Which mode specifier will open a file but will not let you change the file or write to it?

We have textbook solutions for you!

The document you are viewing contains questions related to this textbook.

Programming Logic and Design, Introductory

Farrell

Expert Verified

Get answer to your question and much more

9.Which mode specifier will erase the contents of a file if it already exists and create it if it doesnot exist?a. ‘w’b. ‘r’c. ‘a’d. ‘e’

10. Assume that thecustomerfile 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?

Get answer to your question and much more

11.When a file has been opened using the ‘r’ mode specifier, which method will return the file’scontents as a string?

Get answer to your question and much more

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

Get answer to your question and much more

13.Which method could be used to convert a numeric value to a string?a.strb.valuec.numd.chr

14.Which method will return an empty string when it has attempted to read beyond the end of afile?

Get answer to your question and much more

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

Get answer to your question and much more

d.exception handlerstatementTRUE/FALSE1.True/False: If a file with the specified name already exists when the file is opened, and the file isopened in 'w' mode, then an alert will appear on the screen.2.True/False: When a piece of data is read from a file, it is copied from the file into the program.

Get answer to your question and much more

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 11 pages?

Upload your study docs or become a

Course Hero member to access this document

We have textbook solutions for you!

The document you are viewing contains questions related to this textbook.

The document you are viewing contains questions related to this textbook.

Programming Logic and Design, Introductory

Farrell

Expert Verified

Which of the following describes what happens when a piece of data is written to a file quizlet?

Which of the following describes what happens when a piece of data is written to a file? The data is copied from a variable in RAM to a file.

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

What is the process of retrieving data from a file? Known as reading data from the file.

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

When you work with a direct access file, you can jump directly to any piece of data in the file without reading the data that comes before it.

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

Reading from a File Note that the readline method returns an empty string [ "" ] when it attempt to read beyond the end of the file.

Chủ Đề