Page 367 - C++
P. 367

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

                              for P in PLACES:
                                  if len(P)>5:
                                      print P

                          (1 Mark for correct loop)
                          (½ Mark for checking length of place name)
                          (½ Mark for display desired place names)

                     (e)  Evaluate the following Postfix notation of expression:                               2


                          22,11,/,5,10,*,+,12,-

                   Ans
                                 Element             Stack Contents
                                     22              22
                                     11              22, 11
                                      /              2
                                      5              2, 5
                                     10              2, 5, 10
                                      *              2, 50
                                      +              52
                                     12              52, 12
                                      -              40
                          OR
                          Any other way of stepwise evaluation


                          (½ Mark for evaluation till each operator)
                          OR
                          (1 Mark for only writing the correct answer without showing stack

                          status)

               4     (a)  Write a statement in Python to open a text file STORY.TXT so that new contents                                         1
                          can be added at the end of it.

                   Ans    file= open("STORY.TXT","a") ​OR​ file.open("STORY.TXT","a")

                          (1 mark for correct statement)

                     (b)  Write a method in python to read lines from a text file INDIA.TXT, to find and                                             2
                          display the occurrence of the word “India”.
                          For example:
                          If the content of the file is
                          _______________________________________________________________________
                          “India is the fastest growing economy.
                          India is looking for more investments around the globe.
                          The whole world is looking at India as a great market.
                          Most of the Indians can foresee the heights that India is
                          capable of reaching.”
                          _______________________________________________________________________
                          The output should be 4

                                                        Page #25/35
   362   363   364   365   366   367   368   369   370   371   372