Page 308 - C++
P. 308

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

                              print self.BoxID
                              print self.Side
                              print self.Area

                          (½ Mark for correct syntax for class header)
                          (½ Mark for correct declaration of instance attributes)
                          (1 Mark for correct definition of ExecArea( ) method)
                          (1 Mark for correct definition of NewBox( ) with proper invocation of
                          ExecArea( ))
                          (1 Mark for correct definition of ViewBox( ))
                          NOTE:
                          Deduct ½ Mark if ExecArea( ) is not invoked properly inside NewBox( ) method

                   (d)    Differentiate between static and dynamic binding in Python? Give suitable                             2
                          examples of each.

                   Ans    Static Binding: It allows linking of function call to the function definition during
                          compilation of the program.

                          Dynamic Binding: It allows linking of a function during run time. That means the
                          code of the function that is to be linked with function call is unknown until it is
                          executed. Dynamic binding of functions makes the programs more flexible.

                          (1 mark for each correct explanation of static and dynamic binding)
                          OR
                          (1 for each correct example of static and dynamic binding)
                   (e)     Write   two   methods   in   python   using   concept   of   Function   Overloading  2
                              (Polymorphism) to perform the following operations:
                           (i) A function having one argument as Radius, to calculate Area of Circle as
                              3.14#Radius#Radius
                           (ii) A function having two arguments as Base and Height, to calculate Area of right
                              angled triangle as ​0.5#Base#Height​.

                   Ans    def Area(R):
                              print 3.14*R*R
                          def Area(B,H):
                              print 0.5*B*H

                          Note: Python does not support function overloading “​as illustrated in
                          the example shown above​”. If you run the code, the second Area(B,H)
                          definition will overide the first one.

                          (1 mark for each function definition)
                          OR
                          (Full 2 Marks for mentioning Python does not support function
                          overloading)
             3.    (a)    What will be the status of the following list after the First, Second and Third pass                                              3
                          of the bubble sort method used for arranging the following elements in ​ascending
                          order​?
                          Note: Show the status of all the elements after each pass very clearly underlining
                          the changes.
                          52, 42, -10, 60, 90, 20
                   Ans    I Pass

                                                     Page #18 of 28
   303   304   305   306   307   308   309   310   311   312   313