Page 348 - C++
P. 348

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

                             SECOND S;
                             ___________________       //Statement 1
                             ___________________       //Statement 2
                           }

                     (i)   Which Object Oriented Programming feature is illustrated by the definitions of      1
                           classes FIRST and SECOND?


                    Ans    Inheritance
                           OR
                           Encapsulation
                           OR
                           Data Abstraction
                           OR
                           Data Hiding

                           (1 Mark for writing any correct OOP feature from the given answers)

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

                          Function 2 respectively using the object S.
                    Ans   S.FIRST::Display()​      //Statement 1
                          S.Display()​                   //Statement 2
                          OR
                          S.SECOND::Display()​     //Statement 2


                          (½ Mark for writing correct Statement 1)
                          (½ Mark for writing correct Statement 2)

                     (c)   Write the definition of a class CONTAINER in C++ with the following description:    4
                           Private Members
                           - Radius,Height // float
                           - Type          // int  (1 for Cone,2 for Cylinder)
                           - Volume        // float
                           - CalVolume()   // Member function to calculate
                                           // volume as per the Type
                                 Type         Formula to calculate Volume

                                   1          3.14*Radius*Height
                                   2          3.14*Radius*Height/3

                           Public Members
                           - GetValues() // A function to allow user to enter value
                                         // of Radius, Height and Type. Also, call
                                         // function CalVolume() from it.
                           - ShowAll()   // A function to display Radius, Height,
                                         // Type and Volume of Container

                    Ans    class CONTAINER


                                                        Page #6/35
   343   344   345   346   347   348   349   350   351   352   353