NIELIT O Level Exam

Which mode creates a new file if the file does not exist?

Which mode creates a new file if the file does not exist?

यदि फ़ाइल मौजूद नहीं है तो कौन सा मोड एक नई फाइल बनाता है?

A. write mode राइट मोड

B. read mode रीड मोड

C. append mode अपेण्ड मोड

D. Both (A) And (B) (A) और (B) दोनों




Correct Answer is :

A. write mode



Explanation

In Python, the "w" (write) mode is used to open a file for writing. If the file specified in the open function does not exist, it will create a new file. If the file already exists, opening it in write mode will truncate the file to zero length, effectively erasing its content.

Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad