H13-311_V3.5 · Question #242
What are the steps that are not part of the operation of a Python file object?
The correct answer is B. delete. B (delete) is correct because Python file objects do not have a delete method - deleting a file is handled by the os module (e.g., os.remove()), which operates at the OS level, not through the file object itself. The other four options - open, read, write, and close - represent…
Question
What are the steps that are not part of the operation of a Python file object?
Options
- Aopen
- Bdelete
- Cread
- Dwrite
- Eclose
How the community answered
(52 responses)- A6% (3)
- B77% (40)
- C2% (1)
- D2% (1)
- E13% (7)
Explanation
B (delete) is correct because Python file objects do not have a delete method - deleting a file is handled by the os module (e.g., os.remove()), which operates at the OS level, not through the file object itself. The other four options - open, read, write, and close - represent the core lifecycle of working with a file object: you open() a file to get a file object, read() or write() data through it, then close() it to release the resource. A helpful memory tip: think of the file object's lifecycle as O-R-W-C (Open → Read/Write → Close), and remember that deletion is destruction of the file itself, which belongs to the OS layer, not the file object's interface.
Topics
Community Discussion
No community discussion yet for this question.