Q. What is the use of the 'with' statement when working with files?

  • (A) To automatically close the file
  • (B) To open multiple files
  • (C) To write to a file
  • (D) To append data
πŸ’¬ Discuss
βœ… Correct Answer: (A) To automatically close the file
Explanation: 'with' ensures that the file is properly closed after its block execution.
Explanation by: Mr. Dubey
'with' ensures that the file is properly closed after its block execution.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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