Multiple choice technology web technology

Which of the following mode of fopen() function opens a file only for writing. If a file with that name does not exist, attempts to create anew file. If the file exist, place the file pointer at the end of the file after all other data.

  1. W

  2. W+

  3. A

  4. A+

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The 'a' mode in fopen() opens a file for writing only, positions the pointer at the end, and creates the file if it doesn't exist. 'w' truncates the file, not append. 'w+' allows both read and write but truncates. 'a+' allows both reading and writing without truncating, starting at the end. Therefore 'a' matches the description exactly.