Page 125 - TP_Play_V2.2_Class8
P. 125

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.







                        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

                        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 123
   120   121   122   123   124   125   126   127   128   129   130