MCQ Answer

If a file is open in ‘write’ mode, then

If a file is open in ‘write’ mode, then

यदि फ़ाइल ‘राइट’ मोड में खुली है, तो
Topic : File Processing

A. If it does not exist, an error is returned यदि यह मौजूद नहीं है, तो एक त्रुटि वापस आ जाती है

B. If it does not exist, it is created यदि यह मौजूद नहीं है, तो यह बनाया जाता है

C. If it exists, then data is written at the end यदि यह मौजूद है, तो डेटा अंत में लिखा गया है

D. If it exists, error is returned यदि यह मौजूद है, तो त्रुटि वापस आ जाती है




Correct Answer is :

B. If it does not exist, it is created



Explanation
In C, fopen() is used to open a file in different modes. To open a file in write mode, “w” is specified. When mode “w” is specified, it creates an empty file for output operations. If a file with the same name already exists, its contents are discarded and the file is treated as a new empty file.
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