Page 369 - Computer Science V2.0 Class 11
P. 369

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.                                             _________
                    3.  When a string is enclosed between single quotes, a double quote mark may be included as part of the string.  _________
                    4.  Strings in Python are mutable.                                                          _________
                    5.  The character sequence \n is counted as a single character while computing the length of the string.   _________
                    6.  If, s == 'abc' yields True, the expression s[0:10] will yield an error.                 _________
                    7.  String method split() always returns a tuple of length three.                           _________

                                                                                                            Strings   355
   364   365   366   367   368   369   370   371   372   373   374