Page 366 - C++
P. 366

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

                          ( ½ mark for reading each element of the list using a loop)
                          ( ½ mark for checking whether the value is ending with 0)
                          ( ½ mark for adding it to the sum )
                          ( ½ mark for printing or returning the value)

                     (c)   Write AddClient(Client) and DeleteCleint(Client) methods in python to add a new                              4
                          Client and delete a Client from a List of Client Names, considering them to act as
                          insert and delete operations of the queue data structure.
                   Ans    def AddClient(Client):
                            C=raw_input("Client name: ")
                            Client.append(C)

                          def DeleteClient(Client):
                            if (Client==[]):
                              print "Queue empty"
                            else:
                              print Client[0],"Deleted"
                              del Client[0]           # OR Client.pop(0)
                          OR
                          class queue:
                              Client=[]
                              def AddClient(self):
                                  a=raw_input("Client name: ")
                                  queue.Client.append(a)
                              def DeleteClient(self):
                                  if (queue.Client==[]):
                                      print "Queue empty"
                                  else:
                                      print queue.Client[0],"Deleted"
                                      del queue.Client[0]

                          ( ½ mark insert header)
                          ( ½ mark for accepting a value from user)
                          ( ½ mark for adding value in list)
                          ( ½ mark for delete header)
                          ( ½ mark for checking empty list condition)
                          ( ½ mark for displaying “Queue empty”)
                          ( ½ mark for displaying the value to be deleted)
                          ( ½ mark for deleting value from list)

                     (d)  Write definition of a Method COUNTNOW(PLACES) to find and display those place                                  2
                          names, in which there are more than 5 characters.
                          For example:

                          If the list PLACES contains
                          ["DELHI","LONDON","PARIS","NEW YORK","DUBAI"]
                          The following should get displayed
                          LONDON
                          NEW YORK

                    Ans  def COUNTNOW(PLACES):


                                                        Page #24/35
   361   362   363   364   365   366   367   368   369   370   371