C# File Handling Practice Questions and Exercises

In this chapter you will get practice question of File Handling. You must resolve programming problems using your understanding skills.
Qu 1. You are assigned to develop a project in which project manager wants following functionality.
  1. Create Student Folder in D drive using DirectoryInfo class.
  2. Ask student's name and create a file with that name and store in Student folder.
  3. Ask student's details and save information in that file.
  4. Print following option on console screen.
    1. View Saved File
    2. View Directory Details
 

Hints

Output will be like this
Student Folder Created Successfully at D:\Student

Please Enter your Name :
Steven Clark
Steven Clark file is created at D:\Student\Steven Clark.txt

Please Enter your Details. Your Name:
Steven Clark
Your Age :
22
Your Current City :
LA
Your Subject :
Computer Science
Information Saved on D:\Student\Steven Clark.txt

Select What you want Next.
Press 1 to view Saved File
Press 2 to view Directory Info
Press any key to Exit.
1
Student Name : Steven Clark
Age : 22
City : LA
Subject : Computer Science
_

Summary

File Handling Practice Question will help you to solve real world programming problems. In the next chapter you will learn Inheritance in c#.

 

Share your thought