Developing Mobile Apps — Question 1

Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution. Determine whether the solution meets the stated goals.
You are developing a Universal Windows Platform (UWP) app.
Your app stores files on a users device.
You need to be able to replace the existing files with new files generated by the user.
Solution: You run the StorageFile.GetParentAsync method to get a reference to the existing file. Then, you run the StorageFile.CreateStreamedFileAsync method to create the new file at the same location.
Does this meet the goal?

Answer options

Correct answer:

Explanation

The correct answer is 'No' because the method StorageFile.CreateStreamedFileAsync is used to create a new file, but it does not replace the existing file. The existing file must be deleted or overwritten explicitly to meet the goal of replacing it with a new version. Therefore, the solution does not achieve the stated objective.