Warning: include_once(../../../headder.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/ebooks/xii/computer_science1/data_filehandling4.php on line 16

Warning: include_once(): Failed opening '../../../headder.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/ebooks/xii/computer_science1/data_filehandling4.php on line 16

CBSE Computer Science - Revision Tour(Solved)

CBSE Guess > eBooks > Class XII > CBSE Computer Science Data File Handling Solved Revision Tour By Mr. Ravi Kiran

COMPUTER SCIENCE DATA FILE HANDLING


Warning: include(../../../ads_330x250_middle.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/ebooks/xii/computer_science1/data_filehandling4.php on line 23

Warning: include(): Failed opening '../../../ads_330x250_middle.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/ebooks/xii/computer_science1/data_filehandling4.php on line 23

Previous Index Next

DELHI : 2007

4.a) Observe the program segment given below carefully, and answer the question that follows:

class PracFile
{ int Pracno ;
char PracName[20]
int TimeTaken ;
int Marks ;
public :
void EnterPrac( ) ;
//Function to enter PracFile details
void ShowPrac( ) :
//Function to display PracFile details
int RTime( )
//function to return Time Taken
{return TimeTaken;}
void Assignmarks(int M) //Function to assign Marks
{ Marks = M ;}
} ;
void AllocateMarks( )
{ fstream File ;
File.open (“MARKS.DAT”, ios :: binary l ios :: in l ios :: out ) ;
PracFile P ;
int Record = 0 ;
while (File.read ( (char*) &P, sizeof (P) ) )
{ if (P.RTime( ) > 50)
P.Assignmarks(0)
Else
P.Assignmarks(10)
File.seekp(File.tellp( )-sizeof(P));
//Statement 1
//File.seekp(Record*sizeof(P));
File.write((char*)&P,sizeof(P)); //Statement2
//File.write((char*)&P,sizeof(PracFile));
Record++ ;
}
File . close( ) ;
}

If the function AllocateMarks( ) is supposed to Allocate Marks for the records in the file MARKS.DAT based on their value of the member TimeTaken. Write C++ statements for the statement 1 and statement 2, where, statement 1 is required to position the file write pointer to an appropriate place in the file and statement 2 is to perform the write operation with the modified record.

4.b) Write a function in C++ to print the count of the word is as an independent word in a text file DIALOGUE.TXT.

For example,if the content of the file DIALOGUE.TXT is This is his book. Is this book good ? Then the output of the program should be .

2.

Solution:

Ans) Dear Children, try this answer.

 

Previous Index Next

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



Warning: include(../../../120_60_others.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/ebooks/xii/computer_science1/data_filehandling4.php on line 84

Warning: include(): Failed opening '../../../120_60_others.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/ebooks/xii/computer_science1/data_filehandling4.php on line 84