Q. What is the correct way to ensure a file is closed automatically?

  • (A) Using close() method
  • (B) Using open() method
  • (C) Using with statement
  • (D) Using closefile()
πŸ’¬ Discuss
βœ… Correct Answer: (C) Using with statement
Explanation: Using a with statement ensures the file is properly closed after operations.
Explanation by: Mr. Dubey
Using a with statement ensures the file is properly closed after operations.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
95
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
82%
Success Rate