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

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

CBSE Board Exams Changes to be implemented in exam pattern

CBSE Board Exams Class 10 & 12 2020: Changes to be implemented in exam pattern Are you appearing for the CBSE Class 10 and 12 Board Exams 2020? If yes, then you have to check out what CBSE has brought the major changes for the CBSE class 10 and 12 board exams 2020...

CBSE schools to have sports period daily for classes 1 to 12

All work and no play makes a child dull. Nowadays students have a very hectic schedule so that they cannot take out time to play games and gently start ignoring sports. Therefore, it is the responsibility of schools to include physical education in the curriculum so...

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

IBM to Set AI Curriculum for CBSE Class IX to XII

The Central Board of Secondary Education has tied up with IBM to develop a course of Artificial Intelligence in the CBSE curriculum. Now CBSE is going to introduce Artificial Intelligence as an elective subject for class 9 to 12th. The CBSE has taken this decision to...

CBSE schools to have sports period daily for classes 1 to 12

CBSE schools to have sports period daily for classes 1 to 12, new curriculum introduced All work and no play makes a child dull. Nowadays students have a very hectic schedule so that they cannot take out time to play games and gently start ignoring sports. Therefore,...

CBSE class 10, 12 board exam important information

CBSE class 10, 12 board exam: important information to prevent problems for students : The Central Board of Secondary Education (CBSE) has issued an advisory for the students of class 10 and class 12 board. As per the notice, the registration of students appearing in...

×
Studies Today