Page 295 - C++
P. 295

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


                           protected:
                                 int Y;
                           public:
                                 void Z();
                           };

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

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

                           OR

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

                   (b)     Observe the following C++ code and answer the questions (i) and (ii).
                           Note: Assume all necessary files are included.
                           class TEST
                           {
                             long TCode;
                             char TTitle[20];
                             float Score;
                           public:
                             TEST()                                   //Member Function 1
                             {
                                TCode=100;strcpy(TTitle,”FIRST Test”);Score=0;
                             }
                             TEST(TEST &T)                            //Member Function 2
                             {
                                  TCode=E.TCode+1;
                                  strcpy(TTitle,T.TTitle);
                                  Score=T.Score;
                             }
                           };
                           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 TEST?

                   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     TEST T1; ​                              //Statement 1


                                                     Page #5 of 28
   290   291   292   293   294   295   296   297   298   299   300