Vidyalelo
C# Programming · all questions

File Handling and Input Output in C Sharp
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

112

Questions

2/6

Page

Pick an option on a question to see the right answer and solution.

In C#, which class provides information about a specific file?

Select an option to see the answer and solution.

In C#, which method is used to open an existing text file for reading?

Select an option to see the answer and solution.

What is the purpose of the File.SetAttributes() method in C#?

Select an option to see the answer and solution.

Which class in C# is used to perform synchronous and asynchronous read and write operations to a file in a managed application?

Select an option to see the answer and solution.

In C#, which method is used to write a string to a text file?

Select an option to see the answer and solution.

In C#, what happens if you attempt to read from a file that does not exist using File.OpenRead() method?

Select an option to see the answer and solution.

What is the purpose of the File.Create() method in C#?

Select an option to see the answer and solution.

In C#, which class represents a writer that provides a fast, non-cached, forward-only way of generating sequences of characters from streams of bytes?

Select an option to see the answer and solution.

What is the purpose of the File.WriteAllText() method in C#?

Select an option to see the answer and solution.

In C#, what method is used to create a new file if it does not exist, or overwrite the existing file if it does exist?

Select an option to see the answer and solution.

Which class in C# is used to represent a stream of characters to be written to a file?

Select an option to see the answer and solution.

What is the purpose of the Directory.GetFiles() method in C#?

Select an option to see the answer and solution.

In C#, what is the method used to append lines to a file?

Select an option to see the answer and solution.

What does the File.ReadAllBytes() method do in C#?

Select an option to see the answer and solution.

In C#, which class is used to manipulate paths in a platform-independent manner?

Select an option to see the answer and solution.

In C#, which method is used to read all lines from a file and return them as an array of strings?

Select an option to see the answer and solution.

What happens if you attempt to read from a file that is already open by another process in C#?

Select an option to see the answer and solution.

What is the purpose of the File.Open() method in C#?

Select an option to see the answer and solution.

What is the purpose of the File.GetLastWriteTime() method in C#?

Select an option to see the answer and solution.

In C#, which method is used to delete a directory, and optionally any subdirectories and files in the directory?

Select an option to see the answer and solution.