Find Your Free Essay Examples

Important Questions Class 12 Computer Science C Data File Handling

Free PDF download of Important Questions for CBSE Class 12 Computer Science (C++) Chapter 6 Data File Handling prepared by expert Computer Science (C++) teachers from latest edition of CBSE(NCERT) books, On StudySolver.Org to score more marks in CBSE board examination.

Question 1: Find the output of the following C++ code considering that the binary file CLIENTS.DAT exists on the hard disk with a data of 200 clients:  All India 2017

Question 2: Find the output of the following C++ code considering that the binary file MEM.DAT exists on the hard disk with a data of 1000 members:  Delhi 2016

Question 3: Find the output of the following C++ code considering that the binary file CLIENT.DAT exists on the hard disk with a data of 1000 clients:  All India 2016

Question 4: Find the output of the following C++ code considering that the binary file CLIENT.DAT exists on the hard disk with records of 100 members.  Delhi 2016

Question 5: Find the output of the following C++ code considering that the binary file MEMBER.DAT exists on the hard disk with records of 100 members.  All India 2015

Question 6: Find the output of the following C++ code considering that the binary file GAME. DAT exist on the hard disk with information of around 200 games.  All India 2015 c

Question 7: Fill in the blanks marked as Statement 1 and Statement 2 in the program segment given below with appropriate functions for the required task.  Delhi 2014

Question 8: Fill in the blanks marked as Statement 1 and Statement 2 in the program segment given below with appropriate functions for the required task.  All India 2014

Question 9: Fill in the blanks.marked as Statement 1 and Statement 2 in the program segment given below with appropriate functions for the required task.  All India 2013

Question 10: Fill in the blanks marked as Statement 1 and Statement 2 in the program segment given below with appropriate functions for the required task.  Delhi 2013

Question 11: Fill in the blanks marked as Statement 1 and Statement 2 in the program segment given below with appropriate functions for the required task.  Delhi 2013C

Question 12: Fill in the blanks marked as Statement 1 and Statement 2 in the program segment given below with appropriate functions for the required task.  Delhi 2012C

Question 13: Observe the program segment given below carefully and answer the questions that follow:  All India 2012

(i) Write Statement 1 to position the file pointer to the appropriate place, so that the data updation is done for the required item. (ii) Write Statement 2 to perform the write operation, so that updation is done in the binary file. Answer: Statement 1

Question 14: Observe the program segment given below carefully and answer the questions that follow:  Delhi 2012

(i) Write Statement 1 to position the file pointer to the appropriate place, so that the data updation is done for the required Article. (ii) Write Statement 2 to perform the write operation, so that the updation is done in the binary file. Answer: Statement 1

Question 15: Observe the program segment given below carefully and fill in the blanks marked as Statement 1 and Statement 2 using seekg() or seekp() or tellg() or tellp() functions for performing the required task.  Delhi 2011

Question 16: Observe the program segment given below carefully and fill in the blanks marked as Statement 1 and Statement 2. You can use any function from seekg(), seekp(), tellp() and tellg() for performing the required task.  Delhi 2011C

Question 17: Observe the program segment given below carefully and fill in the blanks marked as Statement 1 and Statement 2 using seekg(), seekp(), tellp() and tellg() functions for performing the required task.  All India 2011

Question 18: Observe the program given below carefully and fill in the blanks marked as Statement 1 and Statement 2 using tellg() and seekp() functions for performing the required task.  All India 2010

Question 19: Observe the program segment given below carefully and fill in the blanks marked as Statement 1 and Statement 2 using tellg() and seekp() functions for performing the required task.  Delhi 2010

Question 20: Observe the program segment given below carefully and fill in the blanks marked as Line 1 and Line 2 using fstream function for performing the required task.  All India 2009

Question 21: Observe the program segment given below carefully and fill in the blank marked as Statement 1 using seekg() or seekp() functions for performing the required task.  Delhi 2009C

Question 22: Observe the program segment given below carefully and fill in the blanks marked as Line 1 and Line 2 using fstream function for performing the required task.  Delhi 2009

Question 23: Polina Raj has used a text editing software to type some text in an article. After saving the article as MYNOTES.TXT, she realised that she has wrongly typed alphabet K in place of alphabet C everywhere in the article. Write a function definition for PURETEXT() in C++ that would display the corrected version of the entire article of the file MYNOTES. TXT with all the alphabets “K” to be displayed as an alphabet “C” on screen. NOTE  Assuming that MYNOTES. TXT does not contain any C alphabet otherwise. Example: If Polina has stored the following content in the file MYNOTES.TXT:

The function PURETEXT() should display the following content:

Question 24: Write a definition for function COUNTPICS() in C++ to read each object of a binary file PHOTOS.DAT, find and display the total number of PHOTOS of type PORTRAIT. Assume that the file PHOTOS.DAT is created with the help of objects of class PHOTOS, which is defined below:

Question 25: Write function definition fof WORD4CHAR() in C++ to read the content of a text file FUN.TXT and display all those words, which has four characters in it. e.g. If the content of the file FUN.TXT is as follows:  Delhi 2016 “When I was a small child, I used to play in the garden with my grand mom. Those days were amazingly funful and I remember all the moments of that time” The function WORD4CHAR() should display the following: “When used play with days were that time” Answer:

Question 26: Write a definition for function BUMPER() in C++ to read each object of a binary file GIFTS.DAT, find and display details of those gifts, which has remarks as “ON,DISCOUNT”. Assume that the file GIFTS.DAT is created with the help of objects of class GIFTS, which is defined below:  Delhi 2016

Question 27: Write function definition of DISP3CHAR() in C++ to read the content of a text file KIDINME.TXT and display all those words, which has three characters in it. All India 2016 e.g. If the content of the file KIDINME.TXT is as follows: ” When I was a small child, I used to play in the garden with my grand mom. Those days were amazingly funful and I remember all the moments of that time.” The function DISP3CHAR() should display the following: “was the mom and all the” Answer:

Question 28: Write a definition for function ONOFFER() in C++ to read each object of a binary file TOYS.DAT, find and display details of those toys, which has status as “ON OFFER”. Assume that the file TOYS.DAT is created with the help of objects of class TOYS, which is defined below:  All India 2016

Question 29: Write function definition for WORDABSTART ()in C++ to read the content of a text file JOY.TXT, and display all those words, which are starting with either ‘A’, ‘a’ or ‘B’, ‘b’.  All India (C) 2016 e.g. If the content of the file JOY.TXT is as follows: “I love to eat apples and bananas. I was travelling to Ahmedabad to buy some clothes.” The function WORDABSTART() should display the following: “apples and bananas Ahmedabad buy” Answer:

Question 30: Write function definition for SUCCESS() in C++ to read the content of a text file STORY.TXT, count the presence of word STORY and display the number of occurrence of this word.  Delhi 2015 NOTE  -The word STORY should be an independent word -Ignore type cases (i.e. lower/upper case) e.g. if the content of the file STORY.TXT is as follows: ” Success shows others that we can do it. It is possible to achieve success with hard work. Lot of money does not mean SUCCESS.” The function SUCCESS() should display the following: “3” Answer: There is error in this question. STORY should be replaced by SUCCESS word, i.e. we have to count SUCCESS word according to output.

Question 31: Write a definition for function Economic() in C++ to read each record of a binary file ITEMS.DAT, find and display those items, which cost less than 2500. Assume that the file ITEMS.DAT is created with the help of objects of class ITEMS, which is defined below:  Delhi 2015

Question 32: Write function definition for TOWER() in C++ to read the content of a text file WRITEUP.TXT, count the presence of word TOWER and display the number of occurrences of this word.  All India 2015 NOTE  – The word TOWER should be an independent word. – Ignore type cases (i.e. lower/upper case). e.g. If the content of the file WRITEUP.TXT is as follows: “Tower, of hanoi is an interesting problem. Mobile phone tower is away from here. Views from EIFFEL TOWER are amazing.” The function TOWER() should display the following : “3 ” Answer:

Question 33: Write a definition for function COSTLY() in C++ to read each record of a binary file GIFTS.DAT, find and display those items, which are priced more than 2000. Assume that the file GIFTS.DAT is created with the help of objects of class GIFTS, which is defined below:  All India 2015

Question 34: Write function definition for COUNTNU( )in C++ to read the content of a text file CONTENT.TXT, count the characters N and U (in lower case as well as upper case) present in the file.  All India 2015 C e.g. Assume the content of the file CONTENT. TXT is as follows: “New research shows that our closest evolutionary relatives have all of the cognitive, capacities required for cooking except an understanding of how to control fire.” The function COUNTNU( )should display the following: “13” Answer:

Question 35: Write a function EUCount() in C++, which should reads each character of a text file. “IMP.TXT”, should count and display the occurrence of alphabets E and U (including small cases e and u too).  Delhi 2014 e.g. If the file contains is as follows:

The EUCount() function should display the output as:

Question 36: Assuming the class GAMES as declared below, write a function in C++ to read the objects of GAMES from binary file “GAMES.DAT” and display the details of those GAMES, which are meant for children of AgeRange “8 to 13”.  Delhi 2014

Question 37: Write a function AECount() in C++, which should read each character of a text file “NOTES.TXT”, should count and display the occurrence of alphabets A and E (including small cases a and e too).  All India 2014 e.g. If the file content is as follows: .

The AECount() function should display the output as

Question 38: Assuming the class TOYS as declared below, write a function in C++ to read the objects of TOYS from binary file “TOYS.DAT” and display the details of those TOYS, which are meant for children of Age Range “5 to 8”.  All India 2014

Question 39: Given a binary file “SPORTS.DAT” containing records programme following class:  All India (C) 2014

Write a function in C++ that would read contents of the file “SPORTS.DAT” and display the details of those players whose rank is above 500. Answer:

Question 40: Write a function Countaroma() to count and display the number of times “Aroma” occurs in a test file “Cook.txt”. All India (C) 2014 NOTE   Only complete word “Aroma“should be counted. Words like “Aromatic“should not be counted. Answer:

Question 41: Write a function CountYouMef) in C++, which reads the content of a text file “story.txt” and counts the words You and Me (not case sensitive).  All India 2013 e.g. if the file contains:

The function should display the output as

Question 42: Write a function CountDig() in C++, which reads the content of text file “story.txt” and displays the number of digits in it. Delhi (C) 2013 e.g. if the file contains:

Then the output on the screen should be

Question 43: Assuming the class WORKER as declared below, write a function in C++ to read the objects of WORKER from binary file named “WORKER.DAT” and display those records of workers, whose wage is less than 300.  Delhi 2013C

Question 44: Write a function CountHisHer() in C++, which reads the contents of a text file “diary.txt” and counts the words His and Her (not case sensitive).  Delhi 2013 e.g. if the file contains:

The function should display the output as

Question 45: Assuming the class VINTAGE as declared below, write a function in C++ to read the objects of VINTAGE from binary file “VINTAGE.DAT” and display those vintage vehicles, which are priced between 200000 and 250000.  Delhi 2013

Question 46: Assuming the class ANTIQUE as declared below, write a function in C++ to read the objects of ANTIQUE from binary file “ANTIQUE.DAT” and display those antique items, which are priced between 10000 and 15000.  All India 2013

Question 47: Write a function in C++ to read the content of a text file “PLACES.TXT” and display all those lines on screen, which are either starting with ‘P’ or starting with ‘S’.  Delhi 2012 Answer:

Question 48: Write a function in C++ to read the content of a text file “DELHI.TXT” and display all those lines on screen, which are either starting with ‘D’ or starting with ‘M’.  All india 2012 Answer:

Question 49: Write a function in C++ to search for the details (Number and Calls) of those Mobile phones, which have more than 1000 calls from a binary file “mobile.dat”. Assuming that this binary file contains records/objects of class Mobile, which is defined below.  Delhi 2012

Question 50: Write a function C++ to search for the details (Phoneno and Calls) of those phones, which have more than 1000 calls from a binary file “phones.dat”. Assuming that this binary file contains records/objects of class Phone, which is defined below. All   India 2012

Question 51: Write a function in C++ to count the number of “Me” or “My” words present in a text file “DIARY.TXT”. If the file “DIARY.TXT” content is as follows:  Delhi 2011

The output of the function should be

Question 52: Write a function in C++ to search!) for a laptop from a binary file “LAPTOP.DAT” containing the objects of class LAPTOP (as defined below). The user should enter the ModelNo and the function should search and display the details of the LAPTOP.  Delhi 2011

Question 53: Write a function in C++ to count the number of “He” or “She” words present in a text file “STORY.TXT”. If the file “STORY.TXT” content is as follows.  All India 2011

The output of the function should be

Question 54: Write a function in C++ to search for a camera from a binary file “CAMERA.DAT” containing the objects of class CAMERA (as defined below). The user should enter the ModelNo and the function should search and display the details of the camera. All India 2011

Question 55: Write a function in C++ to count the words “to” and “the” present in a text file “POEM.TXT”. (Note that the words “to” and “the” are complete words)  All India 2010 Answer:

Question 56: Write a function in C++ to search and display details of all trains, whose destination is “Delhi” from a binary file “TRAIN.DAT”. Assuming the binary file is containing the objects of the following class:  All India 2010

Question 57: Write a function in C++ to count the words “this” and “these” present in a text file “ARTICLE.TXT”. [Note that the words “this” and “these” are complete word]  Delhi 2010 Answer:

Question 58: Write a function in C++ to search and display details of all flights, whose destination is “Mumbai” from a binary file “FLIGHT.DAT”. Assuming the binary file is containing the objects of the following class:  Delhi 2010

Question 59: Write a function COUNT_TO() in C++ to count the presence of a word ‘To” in a text file “NOTES.TXT”.  All India 2009 If the content of the file “NOTES.TXT” is as:

The function COUNT_TO() will display the following message: Count of-to-in file: 3 Answer:

Question 60: Write a function in C++ to read and display the details of all the users whose membership type is ‘L’ or ‘M’ from a binary file “CLUB.DAT”. Assuming the binary file “CLUB.DAT” is containing objects of class CLUB, which is defined as follows:  All India 2009

Question 61: Write a function COUNT_DO() in C++ to count the presence of a word ‘do’ in a text file “MEMO.TXT”.  Delhi 2009 If the content of the file “MEMO.TXT” is as

The function COUNT_DO() will display the following message Count of do in file: 2 Answer:

Question 62: Write a function in C++ to read and display the details of all the users whose status is ‘A’ (i.e. Active) from a binary file “USER.DAT”. Assuming the binary file “USER.DAT” is containing objects of class USER, which is defined as follows:  Delhi 2009

Your email address will not be published. Required fields are marked *

Save my name, email, and website in this browser for the next time I comment.