Page 322 - Computer Science Class 11 With Functions
P. 322

9.  Which of the following calls to str methods will yield a list of all words from the string info?
              a.  info.list()          b. info.partition()  c. info.convert()        d. info.split()
          10.  Which of the following built-in str methods will always return a tuple comprising three elements?
              a.  list()               b. find()              c. partition()         d. split()
          11.  What will be the output produced on execution of the following statements in Python shell of the IDLE environment?
              >>> s1 = "123"
              >>> s2 = "Hello 123"
              >>> s1.isdigit(), s2.isdigit()
              a.  (False, True)        b. (True, False)       c. False               d. True
          12.  What  will  be  the  output  produced  on  the  execution  of  the  following  statements  in  the  Python  shell  of  the  IDLE
              environment?
              >>> country = "India"
              >>> country * 3
              a.  'IndiaIndiaIndia'
              b.  'India India India'
              c.  'India
                India
                India'
              d.  Error
          13.  What will be the output produced on the execution of the following statements in the Python shell of the IDLE environment?
              >>> m1 = "National"
              >>> m2 = "Bird: Peacock"
              >>> m1 + m2
              a.  'National Bird: Peacock'
              b.  'NationalBird:Peacock'
              c.  'NationalBird: Peacock'
              d.  Error

          14.  Which of the following methods will yield the string 'Hello, How Are You?'?
              a.  'Hello, How are you?'.Title()
              b.  'Hello, How are you?'.title()
              c.  'Hello, How are you?'.Sentence()
              d.  'Hello, How are you?'.sentence()
           Consider the following assignment statement to answer Questions 15-16:

           info = "Assemble in ground"
          15.  Which of the following slices will yield a null string?
              a.  info[4:0]            b. info[0:4]           c. info[0:-4]          d. info[-4:0:-1]
          16.  Which of the following slices will return a null string?
              a.  info[1:0]            b. info[3:3]           c. Neither a, nor b    d. Both a and b
          17.  Which of the following built-in methods will return the count of the number of occurrences of a character in a string?
              a.  len()                b. count()             c. find()              d. occurrence()
          18.  Which of the following built-in methods yields a string by removing all whitespace characters appearing at the beginning or
              end of the original string?
              a.  strip()              b. lstrip()            c. rstrip()            d. removeWhite()
        B.  State whether the following statements are True or False:
           1.  A string is always enclosed in double quotes.                                            _________
           2.  A string cannot include special characters.                                              _________

         320   Touchpad Computer Science-XI
   317   318   319   320   321   322   323   324   325   326   327