Page 143 - C++
P. 143

marks=M;
                    }
                    };
                    void Modimarks( )
                    {
                    fstream inout(“Marks.dat”,ios::binary|ios::out||ios::in);
                    LAB ob;
                    int Rec=0;
                    while(inout.read((char*)&ob,sizeof(ob)))
                    {
                    if(ob.RChecked( )==’N’)
                    ob.AssignM(0);
                    else
                    ob.AssignM(10);
                    ____________________ //statement1
                    ____________________ //statement2
                    Rec++;
                    }
                    inout.close( );
                    }
                   If the function Modimarks( ) is supposed to modify Marks for the records in the file Marks.dat based
                   on their status of the member Checked (containing value either ‘Y’ or ‘N’). Write statements for
                   statement1 to position the file write pointer to an appropriate place in the file and statement2 to
                   perform the write operation with the modified record.
                (b)  A librarian maintains the record of books in a file named as “STOCK_BOOK.DAT”. Write a function in
                   C++ to delete a record for book_no 10.                                               [2]
                (c)  Assume a text file “Test.txt” is already created. Using this file, write a function to create three files
                   “LOWER.TXT” which contains all the lowercase vowels and “UPPER.TXT” which contains all the
                   uppercase vowels and “DIGIT.TXT” which contains all digits.                          [3]
              5. (a)  What do you understand by Degree and Cardinality of a table?                      [2]
                (b)  Consider the following tables ACTIVITY and COACH. Write SQL commands for the statements
                   (i) to (iv) and give outputs for SQL queries (v) to (viii)                           [6]
                   Table: ACTIVITY
                     ACode    ActivityName   ParticipantsNum  PrizeMoney    ScheduleDate
                      1001    Relay 100x4          16            10000         23-Jan-2004
                      1002    High jump            10            12000        12-Dec-2003
                      1003    Shot Put             12             8000        14-Feb-2004
                      1005    Long Jump            12             9000         01-Jan-2004
                      1008    Discuss Throw        10            15000        19-Mar-2004
                   Table: COACH
                     PCode         Name         ACode
                        1     Ahmad Hussain     1001
                        2     Ravinder          1008
                        3     Janila            1001
                        4     Naaz              1003

              Model Test Papers                                                                      MTP.5
   138   139   140   141   142   143   144   145   146   147   148