CBSE Class 12 Computer Science Data File Handling In C++ Notes

Download CBSE Class 12 Computer Science Data File Handling In C++ Notes in PDF format. All Revision notes for Class 12 Computer Science have been designed as per the latest syllabus and updated chapters given in your textbook for Computer Science in Class 12. Our teachers have designed these concept notes for the benefit of Class 12 students. You should use these chapter wise notes for revision on daily basis. These study notes can also be used for learning each chapter and its important and difficult topics or revision just before your exams to help you get better scores in upcoming examinations, You can also use Printable notes for Class 12 Computer Science for faster revision of difficult topics and get higher rank. After reading these notes also refer to MCQ questions for Class 12 Computer Science given on studiestoday

Revision Notes for Class 12 Computer Science Data File Handling In C++

Class 12 Computer Science students should refer to the following concepts and notes for Data File Handling In C++ in Class 12. These exam notes for Class 12 Computer Science will be very useful for upcoming class tests and examinations and help you to score good marks

Data File Handling In C++ Notes Class 12 Computer Science

class_12_computer_concept_15

class_12_computer_concept_15a

class_12_computer_concept_15b

class_12_computer_concept_15c

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++.

Class 12 Computer Science Notes
CBSE Class 12 Computer Science All Chapters Notes
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 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 Django Notes
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 Networking Notes
CBSE Class 12 Computer Science Notes Of Cloud Computing And Open Standards Notes
CBSE Class 12 Computer Science Oops Notes
CBSE Class 12 Computer Science Pointers Notes
CBSE Class 12 Computer Science Practicals Notes
CBSE Class 12 Computer Science Programming In CPP Notes Set A
CBSE Class 12 Computer Science Programming In CPP Notes Set B
CBSE Class 12 Computer Science Programming In CPP Notes Set C
CBSE Class 12 Computer Science Programming In CPP Notes Set D
CBSE Class 12 Computer Science Recursion 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

More Study Material

CBSE Class 12 Computer Science Data File Handling In C++ Notes

We hope you liked the above notes for topic Data File Handling In C++ which has been designed as per the latest syllabus for Class 12 Computer Science released by CBSE. Students of Class 12 should download and practice the above notes for Class 12 Computer Science regularly. All revision notes have been designed for Computer Science by referring to the most important topics which the students should learn to get better marks in examinations. Studiestoday is the best website for Class 12 students to download all latest study material.

Notes for Computer Science CBSE Class 12 Data File Handling In C++

Our team of expert teachers have referred to the NCERT book for Class 12 Computer Science to design the Computer Science Class 12 notes. If you read the concepts and revision notes for one chapter daily, students will get higher marks in Class 12 exams this year. Daily revision of Computer Science course notes and related study material will help you to have a better understanding of all concepts and also clear all your doubts. You can download all Revision notes for Class 12 Computer Science also from www.studiestoday.com absolutely free of cost in Pdf format. After reading the notes which have been developed as per the latest books also refer to the NCERT solutions for Class 12 Computer Science provided by our teachers

Data File Handling In C++ Notes for Computer Science CBSE Class 12

All revision class notes given above for Class 12 Computer Science have been developed as per the latest curriculum and books issued for the current academic year. The students of Class 12 can rest assured that the best teachers have designed the notes of Computer Science so that you are able to revise the entire syllabus if you download and read them carefully. We have also provided a lot of MCQ questions for Class 12 Computer Science in the notes so that you can learn the concepts and also solve questions relating to the topics. All study material for Class 12 Computer Science students have been given on studiestoday.

Data File Handling In C++ CBSE Class 12 Computer Science Notes

Regular notes reading helps to build a more comprehensive understanding of Data File Handling In C++ concepts. notes play a crucial role in understanding Data File Handling In C++ in CBSE Class 12. Students can download all the notes, worksheets, assignments, and practice papers of the same chapter in Class 12 Computer Science in Pdf format. You can print them or read them online on your computer or mobile.

Notes for CBSE Computer Science Class 12 Data File Handling In C++

CBSE Class 12 Computer Science latest books have been used for writing the above notes. If you have exams then you should revise all concepts relating to Data File Handling In C++ by taking out a print and keeping them with you. We have also provided a lot of Worksheets for Class 12 Computer Science which you can use to further make yourself stronger in Computer Science

Where can I download latest CBSE Class 12 Computer Science Data File Handling In C++ notes

You can download notes for Class 12 Computer Science Data File Handling In C++ for latest academic session from StudiesToday.com

Can I download the Notes for Data File Handling In C++ Class 12 Computer Science in Pdf format

Yes, you can click on the link above and download notes PDFs for Class 12 Computer Science Data File Handling In C++ which you can use for daily revision

Are the revision notes available for Data File Handling In C++ Class 12 Computer Science for the latest CBSE academic session

Yes, the notes issued for Class 12 Computer Science Data File Handling In C++ have been made available here for latest CBSE session

How can I download the Data File Handling In C++ Class 12 Computer Science Notes pdf

You can easily access the link above and download the Class 12 Notes for Computer Science Data File Handling In C++ for each topic in Pdf

Is there any charge for the Class 12 Computer Science Data File Handling In C++ notes

There is no charge for the notes for CBSE Class 12 Computer Science Data File Handling In C++, you can download everything free of charge

Which is the best online platform to find notes for Data File Handling In C++ Class 12 Computer Science

www.studiestoday.com is the best website from which you can download latest notes for Data File Handling In C++ Computer Science Class 12

Where can I find topic-wise notes for Class 12 Computer Science Data File Handling In C++

Come to StudiesToday.com to get best quality topic wise notes for Class 12 Computer Science Data File Handling In C++

Can I get latest Data File Handling In C++ Class 12 Computer Science revision notes as per CBSE syllabus

We have provided all notes for each topic of Class 12 Computer Science Data File Handling In C++ as per latest CBSE syllabus