Python Exam 2 Questions and Answers
Python Exam 2 Questions and Answers 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. - Correct Answer️️ -False When a piece of data is read from a file, it is copied from the file into the program - Correct Answer️️ -false closing a file disconnects the communication between the file and the program - Correct Answer️️ -true In python, there is nothing that can be donee if the program tries to access a file to read that does not exist - Correct Answer️️ -false Python allows the programmer to work with text and number files - Correct Answer️️ - false The ZeroDivisionError exception is raised when the program attempts to perform the calculation x/y if y = 0 - Correct Answer️️ -true An exception handler is a piece of code that is written using the try/except statement - Correct Answer️️ -true if the last line in a file is not terminated with n, the deadline method will return the line without the n - Correct Answer️️ -true Strings can be written directly to a file with the WRITE method, but the numbers must be converted to strings before they can be written. - Correct Answer️️ -truePDF DOCUMENT It is possible to create a WHILE loop that determines when the end of a file has been reached - Correct Answer️️ -true Which of the following is associated with a specific file and provides a way for the program to work with that file - Correct Answer️️ -the file object What is the process of retrieving data from a file called - Correct Answer️️ -reading data which of the following describes what happens when a piece of data is written to a file - Correct Answer️️ -the data is copied from a variable in RAM to a file Which steep creates a connection between a file and a program - Correct Answer️️ - open the file How many types of files are there - Correct Answer️️ -two A(n) _______ access file is also known as a direct access file - Correct Answer️️ - random 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 - Correct Answer️️ -random A single piece of data within a record is called a - Correct Answer️️ -field Which mode specifier will erase the contents of a file it if already exists and create the file if it does not already exist - Correct Answer️️ -'w' Which mode specifier will open a file but not let you change the file or write to it - Correct Answer️️ -'r' Which method could be used to strip specific characters from the end of a string - Correct Answer️️ -rstripPDF DOCUMENT Which method could be used to convert a numeric value to a string - Correct Answer️️ -str which method will return an empty string when it has attempted t
Written for
- Institution
- Python Programming
- Course
- Python Programming
Document information
- Uploaded on
- June 17, 2024
- Number of pages
- 12
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
-
python exam 2 questions and answers
Also available in package deal