Page 61 - tp_Modula_v2.0
P. 61

2.   Which of the following are the features of functions?

                          a.   A program is divided into small modules and each module performs some
                               specific task. Each module can be called as per the requirement.
                          b.   We can call a function as many times as required.

                          c.   It makes debugging easy and makes the code efficient, both in terms
                               of time and memory.
                          d.   All of the above

                     3.   Which of the following are the components of Python function?
                          a.   Name of the function                     b.   Arguments
                          c.   Return Value                             d.   All of these

                     4.   Which of the following is an example of built-In functions?

                          a.   print( )                                 b.   input( )
                          c.   Both a and b                             d.   None of these
                     5.    Which of the following contains Python statement and makes a function to perform the required
                          task?

                          a.   Function Name                            b.   Parameters
                          c.   Body of the function                     d.   None of these

                 B.  Write 'T' for true and 'F' for false.

                     1.  A function is a block of organised and reusable code.                          ……………………
                     2.  We can call a function as many times as required.                              ……………………
                     3.  A function name should be unique and easy to correlate with the task it
                         will perform.                                                                  ……………………
                     4.  The input given to the functions is referred to as parameters.                 ……………………

                     5.  A function can or cannot have any parameters.                                  ……………………

                 C.  Fill in the blanks using the words given below:


                                                   def, user-defined, built-in, command, return


                       1.   A function may or may not  …………………… a value.

                     2.   The print( ) and input( ) are  …………………… functions.

                     3.   …………………… functions are created by the user according to the need of the program.
                     4.   …………………… keyword begin the function definition.

                     5.    A function can be called anytime from other functions or from the …………………… prompt after
                          the definition.

                 D.  Short answer type questions.

                     1.   What are functions?

                                                                                            Functions in Python   59
   56   57   58   59   60   61   62   63   64   65   66