nerdexam
Huawei

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…

Huawei AI Development Platforms and Solutions

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)
  • A
    6% (3)
  • B
    77% (40)
  • C
    2% (1)
  • D
    2% (1)
  • E
    13% (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

#Python file I/O#file object methods#Python basics#file operations

Community Discussion

No community discussion yet for this question.

Full H13-311_V3.5 Practice