Page 351 - C++
P. 351

CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
                                       (2018-2019 Sub Code: 083       Paper Code: 91)

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

                    (iii)  Write the names of all the members, which are directly accessible by the object S
                          of class Schedule declared in the main() function.
                    Ans  View(), Start()
                          Display(), Initiate()

                          (1 Mark for writing all correct member names )
                          NOTE:
                              ●  Marks not to be awarded for partially correct answer
                              ●  Ignore the mention of Constructors
                    (iv)  What will be the order of execution of the constructors, when the object S of class
                          Schedule is declared inside main() function?

                    Ans  Course(), Teacher(), Schedule()

                          (1 Mark for writing correct order)
                          NOTE:
                           ●  No Marks to be awarded for any other combination/order.
                           ●  Names of the constructor/class without parentheses is acceptable
               3     (a)   Write the definition of a function SumEO(int VALUES[], int N) in C++, which                                     2
                          should display the sum of even values and sum of odd values of the array
                          separately.
                          Example: if the array VALUES contains
                                     25  20  22  21  53

                          Then the functions should display the output as:
                               Sum of even values = 42   (i.e 20+22)
                               Sum of odd values = 99     (i.e 25+21+53)

                    Ans  void SumEO(int VALUES[], int N)
                          {
                            int SE = 0, SO = 0;
                            ​ for (int I=0;I<N;I++)
                            {
                              if(VALUES[I] %2 == 0)
                                 SE += VALUES[I];
                              else
                                 SO += VALUES[I];
                            }
                            cout<< "Sum of even values = " << SE<<endl;
                            cout<< "Sum of odd values = "  << SO<<endl;
                          }
                          OR
                          Any other correct alternative code in C++
                           (½  Mark for correctly writing the loop)
                           (½  Mark for adding even elements)

                                                        Page #9/35
   346   347   348   349   350   351   352   353   354   355   356