Read and download free pdf of CBSE Class 12 Computer Science Data File Handling Worksheet Set B. Students and teachers of Class 12 Computer Science can get free printable Worksheets for Class 12 Computer Science in PDF format prepared as per the latest syllabus and examination pattern in your schools. Standard 12 students should practice questions and answers given here for Computer Science in Grade 12 which will help them to improve your knowledge of all important chapters and its topics. Students should also download free pdf of Class 12 Computer Science Worksheets prepared by school teachers as per the latest NCERT, CBSE, KVS books and syllabus issued this academic year and solve important problems provided here with solutions on daily basis to get more score in school exams and tests
CBSE Class 12 Computer Science - Data File Handling. CBSE issues sample papers every year for students for class 12 board exams. Students should solve the CBSE issued sample papers to understand the pattern of the question paper which will come in class 12 board exams this year. The sample papers have been provided with marking scheme. It’s always recommended to practice as many CBSE sample papers as possible before the board examinations. Sample papers should be always practiced in examination condition at home or school and the student should show the answers to teachers for checking or compare with the answers provided. Students can download the sample papers in pdf format free and score better marks in examinations. Refer to other links too for latest sample papers.
DATA FILE HANDLING
Q1. Define File .
Ans.A file is a bunch of bytes stored on some storage devices.
Q2. How are binary file differ from text files in c++?
Ans When a file is opened in text mode, various character translations may take place, such as the conversion of carriage return and linefeed sequences into newlines. However, no such character translations occur in files opened in binary mode. Any file can be opened in either text or binary mode. The only difference is the occurrence of character translations in text mode.
Q3. What is a stream? Name the streams generally used for file I/O.
Ans A stream is a sequence of bytes. Or in other words, a stream is a flow of bytes into or out of a program. Generally three streams are used for file I/O. These are:
(i) Ifstream: It is derived from istream class and it is used to associate a file with an input buffer so that the file can be read from.
(ii) Ofstream: It is derived from ostream class and it is used to associate a file with an output buffer so that the file can be written from.
(iii) fstream: It is derived from iostream class and it is used to associate a file with a buffer so that the file can be read from as well as written onto.
Q4. Differentiate between ifstream class and ofstream class.
Ans The ifstream class is an input stream class, which provides input operations for file.
The ofstream class is an output stream class, which provides output operations for file.
Q5. Differentiate between functions read() and write().
Ans The read() lets one read a unit of information from a file and a write() lets one write a unit of information to a file.
Q6. Differentiate between getline() and getc() functions.
Ans getc() function can read one character at a time .On the other hand , getline() can read a line of text of specified size.
getc() is defined in stdio.h however getline() is defined in iostream.h
Q7. Name two member functions of ofstream class.
Ans seekp() , tellp()
Q8. Distinguish between ios::out and ios::app.
Ans The ios::out is the default file mode of ofstream. With the mode of the file does not exist, it gets created but if the file exists then its existing contents get deleted. On the other hand ios::app is also an output mode , which creates the file if it does not exist but if the file exists then its existing contents are retained and new information is appended to it.
Q9. What is the difference between the functioning of ios::ate and ios::app file modes.
Ans Both ios::ate and ios::app place the file pointer at the end of the file just opened. The difference between two is that ios::app lets you add data to the end of the file only, while the ios::ate mode when opened with ofstream allows you to write data anywhere in the file, even over old data.
Q10. What is the need and usage of read() and write() functions when there are get() and put() functions for I/O.
Ans The get () and put () function perform I/O byte by byte .On the other hand, read () and write () functions lets you read and write structures and objects in one go without creating the need for I/O for individual constituent fields.
Please click the link below to download full pdf file for CBSE Class 12 Computer Science - Data File Handling.
Click for more Computer Science Study Material ›