Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 139 - 2620_Birla Open Mind C-8
P. 139

    Timeline

                               Functions help us to break our program into smaller parts or modules.
                               Python functions are categorised into in-built functions and user-defined functions.
                                A sequence of characters that are enclosed or surrounded by single (‘ ’), double (“ ”), or triple (''' ''')
                              quotes is known as a string.

                     A.    Choose the correct option.

                            1.  Which type of function is upper( )?
                                     a.  Built-in                                  b.  User-defined

                                     c.  Not a valid function                      d.  None of these

                            2.  What is the input given to the functions referred to as?
                                     a.  Return Value                              b.  Name

                                     c.  Arguments                                 d.  None of these

                            3.  Which of the following operators is used to concatenate two or more strings?
                                     a.  &                                         b.  $

                                     c.  *                                         d.  +

                            4.  Which of the following is used to insert special characters that are invalid in string?
                                     a.  Escape sequence                           b.  Strings

                                     c.  Lists                                     d.  None of these

                            5.  Which operator is used to repeat the string for a given number of times?
                                     a.  Concatenation operator                    b.  Replication operator

                                     c.  len()                                     d.  None of these

                     B.    Fill in the blanks with the correct words.

                                                      Hints  function, capitalize(), string, lower

                            1.   The  _______________ function returns a string with the first character in capital.
                            2.  A  _______________ can be defined as a block of a reusable code that performs a specific task.

                            3.   The _______________ function converts all uppercase letters to lowercase.

                            4.   A consecutive sequence of characters which are enclosed or surrounded by single, double, or triple
                               quotes is known as a _______________ .

                                                                                          #Functions and Strings in Python 137

| 134 135 136 137 138 139 140 141 142 143 144 |