COMPUTER SCIENCE DATA FILE HANDLING

DELHI : 2004

4.a) Assuming that a text file named
FIRST.TXT contains some text written into it, write a function named vowelwords( ), that reads the file FIRST.TXT and creates a new file named SECOND.TXT, to contain only those words from the file FIRST.TXT which start with start with a lowercase vowel (i.e. with ‘a’,’e’, ’I’, ‘o’, ‘u’). For example if the file FIRST.TXT contains Carry umbrella and overcoat when it rains. Then the file SECOND.TXT shallcontain: umbrella and overcoat it

4.b) Assuming the class Computer as follows:

class computer
{ char chiptype[10];
int speed;
public:
void getdetails( )
{ get(chiptype);
cin>>speed;
}
void showdetails( )
{ cout<<”Chip”<<chipt ype<”Speed = “speed;
}
} ;

4.c) Write a function readfile( ) to read all the records present in already existing binary file SHIP.DAT and display them on the screen, also count the number of records present in the file.

DELHI : 2003

4.a) Write a user defined function in C++ to read the content from a text file NOTES.TXT, count and display the number of blank spaces present in it.

4.b) Assuming a binary file FUN.DAT is LAUGHTER (as defined below).Write a user defined function in C++ to add more objects belonging to class LAUGHTER at the bottom of it.

class LAUGHTER
{ int Idno;// Identification number
char Type[5]; //LAUGHTER
Type
char Desc[255]; //Description
public :
void Newentry( )
{ cin>>Idno;gets(Type);gets(Desc);}
void Showonscreen( )
{cout<<Idno<<”:”<<Type<<endl<<Desc<<endl
;}

DELHI : 2002

4.a) What is the difference between pub( ) and write ( )?

4.b) Write a C++ program, which initializes a string variable to the content “Time is a great teacher but unfortunately it kills all its pupils.Berlioz” and outputs the string one character at a time to the disk file OUT.TXT.You have to include all the header files if required.

DELHI : 2001
4.a) Distinguish between ios::out and ios::app. The ios::out mode opens the file in output mode only.The ios::app mode opens the file in append mode, where the file can be appended.

 

CBSE Computer Science Solved Revision Tour By Mr. Ravi Kiran ( [email protected] )