CBSE Class 12 Computer Science
Question 37 of 136
Data File Handling — Question 2
Back to all questionsfobj = open("c:\\test.txt", "w")
Reason — The syntax for 'open()' is: <file variable>/<file object or handle> = open(file_name, access_mode). Therefore, according to this syntax, fobj = open("c:\\test.txt", "w") is the correct statement to open a file for writing. The access mode "w" indicates that the file should be opened in write mode.