Which statement about the File class static methods is TRUE?
hard🧠 Conceptual Q10 of Q15
C Sharp (C#) - File IO
Which statement about the File class static methods is TRUE?
AFile.Move can move files across different drives
BFile.Copy overwrites the destination file by default without error
CFile.Delete does not throw an exception if the file does not exist
DFile.ReadAllText returns null if the file is empty
Step-by-Step Solution
Solution:
Step 1: Analyze each statement
ReadAllText returns empty string if file empty, not null. File.Copy throws if destination exists unless overwrite is true. File.Move cannot move files across different drives. File.Delete does not throw if file missing.
Step 2: Identify the true statement
Only the statement about File.Delete is true.
Final Answer:
File.Delete does not throw an exception if the file does not exist -> Option C
Quick Check:
True statement about File methods = D [OK]
Quick Trick:File.Delete does not throw if file missing [OK]
Common Mistakes:
MISTAKES
Thinking ReadAllText returns null
Assuming Copy overwrites silently
Believing Delete throws if file missing
Master "File IO" in C Sharp (C#)
9 interactive learning modes - each teaches the same concept differently