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

C.  Fill in the blanks.
                    1.  Python module _____is a useful module that enables us to generate random numbers.
                    2.  Functions ceil and floor are available in ______ module of Python.
                    3.  Input arguments specified in a function in an arbitrary order by explicitly associating the names of the formal parameters
                      with their values are known as __________.
                    4.  A _________ value is used only if the corresponding parameter is not given during the function call.
                    5.  Python module ________ enables us to compute statistical quantities like mean, median, and mode.

                 D.  Answer the following questions:
                    1.  Consider the code given below:
                      import math
                      def practice(num):
                          sq = math.sqrt(num)
                          print('Square Root is ', sq)
                      p=49
                      practice(p)
                      Identify the following:
                      a.  Name of user defined function
                      b.  Function header
                      c.  Name of built-in function used to find square root
                      d.  Argument(s)
                      e.  Formal parameter(s)
                      f.  Function Body
                      g.  Function Call Statement

                  Ans.  Name of user-defined function : practice
                      Function header : def practice(num):
                      Name of built-in function used to find square root : sqrt()
                      Argument(s): p
                      Formal parameter(s) : num
                      Function Body:
                      sq=math.sqrt(num)
                      print('Square Root is ',sq)
                      Function Call Statement: practice(p)
                    2.  Identify the function call for determining the following:
                      a.  An odd random integer from the first 100 natural numbers.
                      b.  Value of pi upto 2 decimal places.
                      c.  Log value of 100 to the base 2.
                      d.  Log value of 100 to the base 10.
                      e.  Log value of 100 to the base e.
                      f.  Sine value of angle having degree 45.
                      g.  Tangent value of angle having degree 360.
                      h.  Greatest common divisors of 18 and 34.
                      i.  Mean height of five boys given 150,154, 160, 161, and 165 cm as their heights respectively.
                      j.  Factorial of the number 10.

                  Ans.  a.  random.randrange(1,101,2)
                      b.  round(math.pi,2)
                      c.  math.log(100,2)

                                                                                                           Modules    241
   250   251   252   253   254   255   256   257   258   259   260