Page 365 - C++
P. 365

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

                          (1 Mark for writing correct Inheritance type)

                   (ii)    Find and write the output of the above code.

                   Ans    3 6 9
                          OR
                          “Error” / “No Output”

                          (1 Mark for writing correct answer)

                   (iii)   What are the methods shown in Line 1, Line 3 and Line 5 are known as?

                   Ans    Constructors

                          (1 Mark for writing correct answer)


                   (iv)   What is the difference between the  statements shown in Line 6 and Line 7?

                   Ans    Initializing the member of child class in Line 6 and calling the parent class
                          constructor in Line 7

                          (1 Mark for writing correct answer)

               3     (a)  Consider the following randomly ordered numbers stored in a list                     3
                          786, 234, 526, 132, 345, 467,

                          Show the content of list after the First, Second and Third pass of the bubble sort
                          method used for arranging in ​ascending order​?

                          Note: Show the status of all the elements after each pass very clearly underlining
                          the changes.

                   Ans    I Pass      ​234, 526, 132, 345, 467, 786
                          II Pass     ​234, ​132​, ​345​, ​467​, ​526​, 786
                          III Pass   ​ ​132​, ​234​, ​345​, 467, 526, 786
                          (1 mark for each correct pass)


                     (b)  Write definition of a method ​ZeroEnding(SCORES) to add all those values in the                                    3
                          list of SCORES, which are ending with zero (0) and display the sum.
                          For example,
                          If the SCORES contain [200,456,300,100,234,678]

                          The sum should be displayed as 600

                   Ans    def ZeroEnding(SCORES):
                              s=0
                              for i in SCORES:
                                     if i%10==0:

                                         s=s+i
                              print s

                          ( ½ mark for function header)
                          ( ½ mark for initializing s (sum) with 0)



                                                        Page #23/35
   360   361   362   363   364   365   366   367   368   369   370