Page 73 - C++
P. 73

NOTE:
                             ● Marks not to be awarded for partially correct answer
                             ● Ignore the mention of Constructors

                      (iii)   Write Statement 2 to call function View( ) of class Programme from the
                             object S of class Schedule.

                      Ans.  S.Programme::View( );

                             (1 Mark for writing Statement 2 correctly)

                      (iv)   What will be the order of execution of the constructors, when the object S
                             of class Schedule is declared inside main()?

                      Ans.  Programme( ), Faculty( ), Schedule( )

                                                                OR
                      Ans.  class District : public State
                              {
                             public :
                             char         Dname[20];
                             float         Distance;
                             long  int   Population;
                              void  DINPUT( )
                             {
                             gets(Dname);
                             cin>>distance;
                             cin>>Population;
                             }
                             void     DOUTPUT( )
                             {
                             cout<<Dname<<endl;
                             cout<<Distance<<endl;
                             cout<<population<<endl;
                             }
                             };

                             (1 Mark for writing correct order)
                             ● No Marks to be awarded for any other combination/order.
                             ● Names of the constructor/class without parenthesis is acceptable

                                                                OR

                             (1 Mark for correct syntax for derived class header)
                             (½ Mark for writing public : )
                             (½ Mark for correct declaration of data members Dname ,Distance and
                             Population)
                             (1 Mark for defining the function DINPUT( ) )
                             (1 Mark for defining the function DOUTPUT( ) )

                                                              9
   68   69   70   71   72   73   74   75   76   77   78