NCERT Solutions Class 12 Computer Science Data File Handling

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

Answer:

void word_count ()

{

ifstream i;char ch[20];int c=0;

i.open("opinion.txt"); while(!i.eof())

{

i>>ch;

C=C+1;

}

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

Example:

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

Answer:

#include

#include

void wordcount()

{ char word[80];

int cnt=0;

ifstream fl;

f1.open("VOWEL.TXT");

while (fl>>word)

{

if (strlen(word) == 3)

{

cnt++;

cout<<word<<endl;

}

}

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

f1.close();

}

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

Tags: 

 


Click to View or Download pdf file
Click for more Computer Science Study Material

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

CBSE Boards Answer Sheet Evaluation Class 10 and Class 12

HRD Minister Ramesh Pokhriyal, through a video conference with all the education ministers of the state, discussed the further steps to be taken to smoothen the education process during the Covid-19 lockdown. The most important topic which was discussed repeatedly on...

TV Channels for Students by CBSE

In enhancing the students studying part, the Government is planning to introduce one standard one channel plan. The lockdown in India has adversely collapsed all the operations including schools, colleges, and workplaces with unanticipated setbacks. On behalf of the...

CBSE Board 2020 Important announcement regarding rescheduling of Class 10 12 Board Exams

CBSE Board Exams 2020: Here's when Board will organize the CBSE Class X and Class XII Board Exams.   All the candidates appearing for CBSE Standard X and Standard XII Board Exams 2020 can cross-check the essential notice released by the board concerning the...

Important announcement regarding rescheduling of Class 10 and 12 Board Exams

CBSE Board Exams 2020: Here's when Board will organize the CBSE Class X and Class XII Board Exams. All the candidates appearing for CBSE Standard X and Standard XII Board Exams 2020 can cross check the essential notice released by the board concerning rearrangement of...

Procedure for correction in Name and Date of Birth

Procedure for correction in Name and Date of Birth in CBSE records Name Change: Applications regarding changes in name or surname of candidates will be considered provided the changes have been admitted by the Court of law and notified in the Government Gazette before...

Live session by CBSE Experts for holistic wellbeing

CBSE and Fit India Mission have collaborated to provide live sessions by experts covering a range of topics for holistic well-being of school going children, which will include simple actionable tips around Basic Exercises, Nutrition, Yoga & Meditation, boosting...

×
Studies Today