1.
Which C# class should be used to work with binary data in files?
2.
What is the effect of calling File.Move() on an existing file?
3.
What method should be used to ensure a StreamWriter is properly disposed of?
4.
Which class in C# is used to write primitive types to a binary file?
5.
What method is used to read all lines from a file into a string array?
6.
What is the correct way to handle exceptions in file and directory operations?
7.
Which FileMode option would you use to append data to an existing file?
8.
What method is used to delete a file?
9.
What type of file is ideal to be handled with StreamReader and StreamWriter?
10.
Which method should be used to check the existence of a file?
11.
What is the root directory symbol in UNIX-style paths?
12.
What is the correct way to represent a Windows path in C# to avoid escape sequence issues?
13.
Which of the following is an asynchronous file operation?
14.
Which namespace in C# contains the classes for handling files and directories?
15.
Which of the following methods will move a file to a new location?
16.
What happens when you call File.AppendAllText() on a file that already exists?
17.
What method is used to read all text from a file in C#?
18.
Which class provides non-static methods for performing operations like creating, deleting, and reading files in C#?
19.
In the following code, what is the purpose of the using statement?
using (StreamWriter writer = new("Customers.txt"))
{
writer.WriteLine("Al Pacino");
}
20.
Which of the following methods writes a string to a file, overwriting the file if it already exists?
21.
What happens if you attempt to delete a non-empty directory using Directory.Delete() without additional parameters?
22.
What is the purpose of the Directory.SetCurrentDirectory() method?
23.
Which of the following is NOT a valid mode for opening a file in C#?
24.
What method is used to check if a directory exists in the current working directory?
25.
Which class provides static methods for creating, deleting, and moving directories?