Skip to main content

File Handling And Input Output In C Sharp — Part 1 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on File Handling And Input Output In C Sharp — Part 1 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.

Questions
40
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
48 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
40

Verified Practice Questions

Interactive test mode with detailed academic worked solutions

Live Progress | 0/40 answered
✓ 0 correct ✗ 0 wrong 0% score
Question 1 of 40
★ FPSC ★ PPSC

Which class in C# is used to read data from text files?

Question 2 of 40
★ FPSC ★ PPSC

What is the purpose of the using statement when working with files in C#?

Question 3 of 40
★ FPSC ★ PPSC

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

Question 4 of 40
★ FPSC ★ PPSC

What is the correct way to open a file for writing in C#?

Question 5 of 40
★ FPSC ★ PPSC

In C#, which class is used to manipulate directories and files?

Question 6 of 40
★ FPSC ★ PPSC

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

Question 7 of 40
★ FPSC ★ PPSC

In C#, which method is used to read the entire contents of a file into a string?

Question 8 of 40
★ FPSC ★ PPSC

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

Question 9 of 40
★ FPSC ★ PPSC

In C#, which method is used to delete a file?

Question 10 of 40
★ FPSC ★ PPSC

Which class in C# provides methods for synchronous reading and writing operations on files?

Question 11 of 40
★ FPSC ★ PPSC

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

Question 12 of 40
★ FPSC ★ PPSC

In C#, which method is used to determine the size of a file in bytes?

Question 13 of 40
★ FPSC ★ PPSC

What is the correct way to close a file after reading or writing in C#?

Question 14 of 40
★ FPSC ★ PPSC

In C#, which method is used to create a new directory?

Question 15 of 40
★ FPSC ★ PPSC

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

Question 16 of 40
★ FPSC ★ PPSC

In C#, which class provides methods for creating, copying, deleting, and moving directories and subdirectories?

Question 17 of 40
★ FPSC ★ PPSC

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

Question 18 of 40
★ FPSC ★ PPSC

Which method is used to read a single character from a text file in C#?

Question 19 of 40
★ FPSC ★ PPSC

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

Question 20 of 40
★ FPSC ★ PPSC

Which of the following methods is used to determine whether the specified file exists in C#?

Question 21 of 40
★ FPSC ★ PPSC

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

Question 22 of 40
★ FPSC ★ PPSC

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

Question 23 of 40
★ FPSC ★ PPSC

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

Question 24 of 40
★ FPSC ★ PPSC

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

Question 25 of 40
★ FPSC ★ PPSC

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

Question 26 of 40
★ FPSC ★ PPSC

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

Question 27 of 40
★ FPSC ★ PPSC

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

Question 28 of 40
★ FPSC ★ PPSC

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?

Question 29 of 40
★ FPSC ★ PPSC

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

Question 30 of 40
★ FPSC ★ PPSC

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?

Question 31 of 40
★ FPSC ★ PPSC

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

Question 32 of 40
★ FPSC ★ PPSC

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

Question 33 of 40
★ FPSC ★ PPSC

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

Question 34 of 40
★ FPSC ★ PPSC

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

Question 35 of 40
★ FPSC ★ PPSC

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

Question 36 of 40
★ FPSC ★ PPSC

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

Question 37 of 40
★ FPSC ★ PPSC

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

Question 38 of 40
★ FPSC ★ PPSC

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

Question 39 of 40
★ FPSC ★ PPSC

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

Question 40 of 40
★ FPSC ★ PPSC

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

✓ Link copied to clipboard
Continue Your Practice

Advance Html — Part 1

Master the next curriculum module with 40 exam-standard MCQs.

Next Practice Set →

💡 Examiner's Advisory for Programming & Software Development

In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.

More Modules in Programming & Software Development

View All →
📚

Study Guides

Topic summaries and syllabus breakdown

Explore Guides →
🎯

Complete Library

Search through 78,000+ verified MCQs

Browse Library →
📱

Mobile App

Offline mock tests and instant bookmarks

Get Mobile App →