Page 215 - C++
P. 215

(c) Given a binary file “AMOUNT.DAT”, containing records of the given class outstand type.
               class outstand
               {
                       int    memno;
                       int    outamt;
               public :
                       void getit( )
                       {      cin>>memno>>outamt;          }
                       void putit( )
                       {      cout<<memno<<outamt;         }
                       int    returnamt( )
                       {      return outamt;               }
               };
           Write a function in C++ to write objects having outamt more than Rs. 10,000 into CRITICAL.DAT file.     [3]

   Q.5(a) Observe the following Table and answer the parts (i) and (ii) accordingly
                              Table :  MEMBER

        Mno                     Name                    Qty                     PurchaseDate
        101                     Pen                     102                     12-12-2011
        102                     Pencil                  201                     21-02-2012
        102                     Eraser                    90                    09-08-2010
        109                     Sharpener                 90                    31-08-2012
        113                     Clips                   900                     08-08-2011
        (i) In the above table , can we take Mno as Primary Key ? (Answer as [YES/NO] only) . Justify your answer with a valid
           reason.
        (ii)What is the degree and the cardinality of the above table ?                                      [2]
      Consider the following tables SUBJECT  and  TEACHER and answer (b) , (c) , (d) and (e) parts of this question :
                              Table :  SUBJECT
      Code                    Title                   Marks_Theory            Marks_Prac
      301                     English                 100                     0
      041                     Maths                   100                     0
      083                     Computer Sc             70                      30
      042                     Physics                 70                      30
      043                     Chemistry               70                      30

                              Table :  TEACHER
               TCode          Name                             Sub_Code
               1              P.Jain                           301
               2              R.Nagpal                         301
               3              Supatra                          041
               4              Shabnam                          083
               5              Rashika                          042
               6              Vidushi                          041
               7              Yash                             043

   (b) Write SQL commands for the following statements:
        (i) To display the names of all the subjects for which practical marks are 0 ,
        (ii) To display the total number of teachers in each subject separately.
        (iii) To display the names of all the teachers in the ascending order of the Sub_Code.
        (iv) To display each subject’s details along with Totak_Marks in each subject from the table SUBJECT.
                    (Total_Marks =  Marks_Theory  +  Marks_Practical).                                              [4]




                                                                                                                   5
   210   211   212   213   214   215   216   217   218   219   220