Page 246 - C++
P. 246

CBSE AISSCE 2016-2017 Marking Scheme for Computer Science
                                         (Sub Code: 083 Paper Code 91/1 Delhi)
                          OR

                          Any other correct example demonstrating difference between private and
                          public members of a class

                           (Full 2 Marks for any one correct difference between private and public
                           members of a class using a suitable code in C++)

                           OR

                           (1 Mark for writing correct difference between private and public members
                           in a class without example)

                   (b)     Observe the following C++ code and answer the questions (i) and (ii).
                           Note: Assume all necessary files are included.

                           class EXAM
                           {
                             long Code;
                             char EName[20];
                             float Marks;
                           public:
                             EXAM()                                   //Member Function 1
                             {
                               Code=100;strcpy(EName,"Noname");Marks=0;
                             }
                             EXAM(EXAM &E)                            //Member Function 2
                             {
                                  Code=E.Code+1;
                                  strcpy(EName,E.EName);
                                  Marks=E.Marks;
                             }
                           };
                           void main()
                           {
                             ___________________                      //Statement 1
                             ___________________                      //Statement 2
                           }


                   (i)    Which Object Oriented Programming feature is illustrated by the Member              1
                          Function 1 and Member Function 2 together in the class EXAM?

                   Ans     Polymorphism OR Constructor overloading OR Function Overloading


                           (1Mark for mentioning the correct concept name )

                   (ii)   Write Statement 1 and Statement 2 to execute Member Function 1 and                                1
                          Member Function 2 respectively.

                   Ans     EXAM E1; ​                              //Statement 1

                           EXAM E2(E1);​                       //Statement 2
                           OR
                           EXAM E2=E1; ​                      //Statement 2




                                                     Page #5 of 28
   241   242   243   244   245   246   247   248   249   250   251