NCERT Solutions Class 12 Computer Science Data File Handling

Scroll down for PDF

NCERT Solutions Class 12 Computer Science Data File Handling. NCERT book for Computer Science in class 12 is strongly recommened by teachers and the CBSE and NCERT boards. Please download the NCERT solutions for class 12 Computer Science free in PDF made by teachers of the best schools in India. These solutions are carefully compiled to give detailed understanding of the concepts and also steps of solutions. The NCERT solutions are free to download in pdf format. Please refer to the download link below to download the pdf file and also refer to other chapters and subjects to get the solutions to Computer Science NCERT book questions and exercises.

Chapter - Data File Handling

Question 1. Write a user defined function word_count() in C+ + to count how many words are present in a text file named “opinion.txt”. For Example, if the file opinion.txt contains following text: Co-education system is necessary for a balanced society. With co-education system. Girls and Boys may develop a feeling of mutual respect towards each other.

The function should display the following: Total number of words present in the text file are:24


void word_count ()


ifstream i;char ch[20];int c=0;"opinion.txt"); while(!i.eof())





cout<<"Total number of words present in the text file are: "<<c;


Question 2. Write a function in C + + to count and display the no of three letter words in the file “VOWEL.TXT”.


If the file contains:

A boy is playing there. I love to eat pizza. A plane is in the sky.

Then the output should be : 4




void wordcount()

{ char word[80];

int cnt=0;

ifstream fl;"VOWEL.TXT");

while (fl>>word)


if (strlen(word) == 3)






cout<<" number of three letter words = ”<<cnt;



Please click on link below to download NCERT Solutions Class 12 Computer Science Data File Handling.


Click on the text For more study material for Computer Science please click here - Computer Science

Latest NCERT & CBSE News

Read the latest news and announcements from NCERT and CBSE below. Important updates relating to your studies which will help you to keep yourself updated with latest happenings in school level education. Keep yourself updated with all latest news and also read articles from teachers which will help you to improve your studies, increase motivation level and promote faster learning

Extension of dates by CBSE for Single Girl Child Merit (SGC) scholarship

CBSE has announced to extend dates for SGC scholarship. Previously the dates to submit the SGC scholarship form were 18 October 2019. Now dates have shifted. For online submission, the last date is 31st October. Whereas date for submission of hard copies of renewal...

CBSE to launch 'Tamanna' aptitude test

Introduction: The poor decisive condition of students to pursue their subject of interest has been an area of concern. To the ease of which CBSE is to launch ‘Tamanna’. An aptitude test in order to provide a line of guidance to students of class 9th and 10th. What is '...

Sample Papers for Class 10 Boards 2020

CBSE has recently released the Class 10 Sample Papers for Board exams which are to be held in March 2020. The sample papers have been for class 10 for all subjects along with the suggested marking scheme. CBSE releases these suggested papers every year so that the...

JEE Main registration 2020 List of qualifying exams

JEE Main registration 2020: List of qualifying exams The process of JEE (Joint Entrance Examination) Main has already been started from September 3, 2019, on the official website of JEE, i.e. The interested and eligible students can also apply for JEE...

CBSE and Microsoft join hands to build capacity for AI learning for schools

Central Board of Secondary Education and Microsoft join hands to build capacity for AI learning for schools : The officials from the Central Board of Secondary Education have announced that they have partnered with Microsoft India to conduct several capacity building...

CBSE Class 12th Board Exam 2020

CBSE Class 12th Board Exam 2020: Here are some exam preparation tips Every year the Central Board of Secondary Education (CBSE) conducts annual board exams for the students of 10th and 12th grade in February / March. Class 12th board exams play a very significant role...

Studies Today