Page 285 - C++
P. 285

3.   (a)     What will be the status of the following list after the First, Second
                   and  Third  pass  of  the  bubble  sort  method  used  for  arranging  the
                   following elements in ascending order ?                                         3

                   Note  :  Show  the  status  of  all  the  elements  after  each  pass  very
                   clearly underlining the changes.
                           52, 42, –10, 60, 90, 20

           (b)     Write  definition  of  a  method  EvenSum(NUMBERS)  to  add  those
                   values in the list of NUMBERS, which are odd.                                   3

           (c)     Write Addnew(Member) and Remove(Member) methods in Python to
                   Add a new Member and Remove a Member from a list of Members,
                   considering them to act as INSERT and DELETE operations of the
                   data structure Queue.                                                           4

           (d)     Write definition of a method MSEARCH(STATES) to display all the
                   state  names  from  a  list  of  STATES,  which  are  starting  with
                   alphabet M.                                                                     2
                   For example :

                   If the list STATES contains
                   ["MP","UP","WB","TN","MH","MZ","DL","BH","RJ","HR"]
                   The following should get displayed :

                   MP

                   MH
                   MZ

           (e)     Evaluate the following Postfix notation of expression :                         2
                           4,2,*,22,5,6,+,/,-




      4.   (a)     Differentiate between file modes r+ and rb+ with respect to Python.             1

           (b)     Write  a  method  in  Python  to  read  lines  from  a  text  file
                   MYNOTES.TXT,  and  display  those  lines,  which  are  starting  with
                   the alphabet ―K‖.                                                               2

           (c)     Considering  the  following  definition  of  class  FACTORY,  write  a
                   method in Python to search and display the content in a pickled file

                   FACTORY.DAT, where FCTID is matching with the value ―105‖.                      3

      91                                            15                                        P.T.O.
   280   281   282   283   284   285   286   287   288   289   290