MCQ Answer

Which file mode creates a new file but raises an error if it exists?

Which file mode creates a new file but raises an error if it exists?

File mode में यदि file मौजूद नहीं है लेकिन पढ़ने से पहले create करनी है, तो कौन-सा mode उपयोग होगा?
Topic : File Processing in Python

A. w+

B. a

C. x

D. r+




Correct Answer is :

C. x



Explanation
Exclusive creation mode x creates a file only if it does not already exist.

x mode नई file बनाता है और file पहले से मौजूद होने पर error देता है।
Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Best Website and Software Company in Allahabad