Download the latest CBSE Class 12 Computer Science Data File Handling In C++ Notes in PDF format. These Class 12 Computer Science revision notes are carefully designed by expert teachers to align with the 2025-26 syllabus. These notes are great daily learning and last minute exam preparation and they simplify complex topics and highlight important definitions for Class 12 students.
Chapter-wise Revision Notes for Class 12 Computer Science Data File Handling In C++
To secure a higher rank, students should use these Class 12 Computer Science Data File Handling In C++ notes for quick learning of important concepts. These exam-oriented summaries focus on difficult topics and high-weightage sections helpful in school tests and final examinations.
Data File Handling In C++ Revision Notes for Class 12 Computer Science
If the function modify( ) modifies a record in the file “ item.dat “ with the values of item x passed as argument, write the appropriate parameter for the missing parameter in the above code, so as to modify record at its proper place.
Ans.1. File.seekp((recordsRead-1)*sizeof(x),ios::beg); or File.seekp(-1*sizeof(x),ios::cur);
General program structure used for operating a Text File
2 Marks Questions
Text files in input mode:
Write a function in a C++ to count the number of lowercase alphabets present in a text file “BOOK.txt”.
int countalpha()
{ ifstream Fin(“BOOK.txt”);
char ch;
int count=0;
while(!Fin.eof())
{Fin.get(ch);
if (islower(ch))
count++;
}
Fin.close();
return count;
}
Function to calculate the average word size of a text file.
void calculate()
{ fstream File;
File.open(“book.txt”,ios::in);
char a[20];
char ch;
int i=0,sum=0,n=0;
while(File)
{ File.get(ch);
a[i]=ch;
i++;
if((ch==’ ‘) || ch(== ‘.’)||(char==’,’)(ch==’\t’)||(ch==’\n’)
{i --; sum=sum +i;
i=0; N++;
}
}
cout<<”average word size is “<<(sum/n);
}
Assume a text file “coordinate.txt” is already created. Using this file create a C++ function to count the number of words having first character capital.
int countword()
{ ifstream Fin(“BOOK.txt”);
char ch[25];
int count=0;
while(!Fin.eof())
{Fin>>ch;
if (isupper(ch[0]))
count++;
}
Fin.close();
return count;
}
Function to count number of lines from a text files (a line can have maximum 70 characters or ends at ‘.’)
int countword()
{ ifstream Fin(“BOOK.txt”);
char ch[70];
int count=0;
if (!Fin)
{ cout<<”Error opening file!” ;
exit(0);
}
while(1)
{Fin.getline(ch,70,‘.’);
if (Fin.eof())
break;
count++;
}
Fin.close();
return count;
}
A program to display the size of a file in bytes.
#include<iostream.h>
#include<fstream.h>
#include<process.h>
#include<conio.h>
int main()
{
char filename[13];
clrscr();
cout<”Enter Filename:\n”;
cin.getline(filename,13);
ifstream infile(filename);
if(!infile)
{cout>>”sorry ! Can not open “<<filename <<”file\n”;
exit(-1);
}
long no_bytes=0;
char ch;
infile.seekg(0,ios::end);
no_bytes=infile.tellg();
cout<<”File Size is”<<no_bytes<<”bytes\n”;
return 0;
}
Text files in output mode:
C++ program, which initializes a string variable to the content “There is an island of opportunity in the middle of every difficulty.” and output the string one character at a time to the disk file “OUT.TXT”.
#include<fstream.h>
int main()
{ ofstream fout(“OUT.TXT”);
char *str = ”There is an island of opportunity in the middle of every difficulty.” ;
int i=0;
if(!fout)
{
cout<<”File cannot be opened “;
return 0;
}
while (str[i]!=’\0’)
{fout<<str[i];
i++;
}f
out.close();
}
Exercise: (2 Marks Questions)
1. te a function in a C++ to count the number of uppercase alphabets present in a text file “BOOK.txt”
2. Write a function in a C++ to count the number of alphabets present in a text file “BOOK.txt”
3. Write a function in a C++ to count the number of digits present in a text file “BOOK.txt”
4. Write a function in a C++ to count the number of white spaces present in a text file “BOOK.txt”
5. Write a function in a C++ to count the number of vowels present in a text file “BOOK.txt”
6. Write a function in a C++ to count the average word size in a text file “BOOK.txt”
7. Write a function in C++ to print the count of the word “the” as an independent word in a text file
STORY.TXT.
For example, if the content of the file STORY.TXT is
There was a monkey in the zoo.
The monkey was very naughty.
Then the output of the program should be 2.
8. Assume a text file “Test.txt” is already created. Using this file, write a function to create three
files “LOWER.TXT” which contains all the lowercase vowels and “UPPER.TXT” which contains
all the uppercase vowels and “DIGIT.TXT” which contains all digits.
9. Create a function FileLowerShow() in c++ which take file name(text files)as a argument and display its all data into lower case
10. Write a function in C++ to count the number of lines present in a text file “Story.txt”.
HOTS FILE HANDLING
1. Write a function in a C++ to count the number of consonants present in a text file “Try.txt”
2. Write a function in a C++ to count the number of uppercase vowels present in a text file “Novel.txt”
3. Write a function in a C++ to display the sum of digits present in a text file “Fees.txt”.
4. Write a function in a C++ to display the product of digits present in a text file “Number.txt”.
5. Write a function in a C++ to find the largest digit present in a text file “Marks.txt”
3 Marks Questions
General program structure used for operating a Binary File
Program to read and write a structure using read() and write() using binary file.
struct student
{
char name[15];
float percent;
};
void main()
{
clrscr();
student s;
strcpy(s.name,”rasha”);
s.percent=89.50;
ofstream fout;
fout.open(“saving”, ios::out | ios:: binary);
if(!fout)
Please click the link below to download pdf file for CBSE Class 12 Computer Science - Data File Handling In C++.
| CBSE Class 12 Computer Science Boolean Algebra Notes Set A |
| CBSE Class 12 Computer Science Boolean Algebra Notes Set B |
| CBSE Class 12 Computer Science Boolean Algebra Notes Set C |
| CBSE Class 12 Computer Science Notes Of Cloud Computing And Open Standards Notes |
| CBSE Class 12 Computer Science Communication And Computer Networks Notes |
| CBSE Class 12 Computer Science Communication And Network Notes Set A |
| CBSE Class 12 Computer Science Communication And Network Notes Set B |
| CBSE Class 12 Computer Science Computer Networks Notes |
| CBSE Class 12 Computer Science Data File Handling In C++ Notes |
| CBSE Class 12 Computer Science Data Structure Notes Set A |
| CBSE Class 12 Computer Science Data Structure Notes Set B |
| CBSE Class 12 Computer Science Data Structure Notes Set C |
| CBSE Class 12 Computer Science Data Structures Notes |
| CBSE Class 12 Computer Science Data Visualization Using Pyplot Notes |
| CBSE Class 12 Computer Science Database And SQL Notes Set A |
| CBSE Class 12 Computer Science Database And SQL Notes Set B |
| CBSE Class 12 Computer Science File Handling Notes |
| CBSE Class 12 Computer Science Free And Open Source Software Notes |
| CBSE Class 12 Computer Science Functions In Python Notes |
| CBSE Class 12 Computer Science Idea of Efficiency Notes |
| CBSE Class 12 Computer Science Interface Python with an SQL database Notes |
| CBSE Class 12 Computer Science Introduction To C++ Notes |
| CBSE Class 12 Computer Science Revision of The Basics of Python Notes |
| CBSE Class 12 Computer Science Society Law and Ethics Notes |
| CBSE Class 12 Computer Science SQL Commands Aggregation Functions Notes |
| CBSE Class 12 Computer Science Using Python Libraries Notes |
Important Practice Resources for Class 12 Computer Science
CBSE Class 12 Computer Science Data File Handling In C++ Notes
Students can use these Revision Notes for Data File Handling In C++ to quickly understand all the main concepts. This study material has been prepared as per the latest CBSE syllabus for Class 12. Our teachers always suggest that Class 12 students read these notes regularly as they are focused on the most important topics that usually appear in school tests and final exams.
NCERT Based Data File Handling In C++ Summary
Our expert team has used the official NCERT book for Class 12 Computer Science to design these notes. These are the notes that definitely you for your current academic year. After reading the chapter summary, you should also refer to our NCERT solutions for Class 12. Always compare your understanding with our teacher prepared answers as they will help you build a very strong base in Computer Science.
Data File Handling In C++ Complete Revision and Practice
To prepare very well for y our exams, students should also solve the MCQ questions and practice worksheets provided on this page. These extra solved questions will help you to check if you have understood all the concepts of Data File Handling In C++. All study material on studiestoday.com is free and updated according to the latest Computer Science exam patterns. Using these revision notes daily will help you feel more confident and get better marks in your exams.
You can download the teacher prepared revision notes for CBSE Class 12 Computer Science Data File Handling In C++ Notes from StudiesToday.com. These notes are designed as per 2025-26 academic session to help Class 12 students get the best study material for Computer Science.
Yes, our CBSE Class 12 Computer Science Data File Handling In C++ Notes include 50% competency-based questions with focus on core logic, keyword definitions, and the practical application of Computer Science principles which is important for getting more marks in 2026 CBSE exams.
Yes, our CBSE Class 12 Computer Science Data File Handling In C++ Notes provide a detailed, topic wise breakdown of the chapter. Fundamental definitions, complex numerical formulas and all topics of CBSE syllabus in Class 12 is covered.
These notes for Computer Science are organized into bullet points and easy-to-read charts. By using CBSE Class 12 Computer Science Data File Handling In C++ Notes, Class 12 students fast revise formulas, key definitions before the exams.
No, all study resources on StudiesToday, including CBSE Class 12 Computer Science Data File Handling In C++ Notes, are available for immediate free download. Class 12 Computer Science study material is available in PDF and can be downloaded on mobile.