Page 289 - Computer Science Class 11 With Functions
P. 289
8 math.sqrt(num) Positive integer Square root of num >>> math.sqrt(25)
or floating point 5.0
number >>> math.sqrt(40.5)
6.363961030678928
9 math.sin(num) Integer or Arc Sine of num in >>> math.sin(0)
floating point radians 0.0
number in >>> math.sin(0.2)
radians 0.19866933079506122
10 math.cos(num) Integer or Arc cosine of num in >>> math.cos(0)
floating point radians 1.0
number in >>> math.cos(10)
radians -0.8390715290764524
11 math.tan(num) Integer or Arc tangent of num >>> math.tan(0)
floating point in radians 0.0
number in >>> math.tan(1)
radians 1.5574077246549023
Ø This process of dividing a computer program into separate independent blocks of code or sub-programs with
different names and functionalities is known as modular programming.
Ø Each independent unit of code is called a module.
Ø A function is a sub-program that acts on data to perform a particular task and often returns a value.
Ø A function is always defined before it is called.
Ø Functions can be broadly classified into user-defined functions, built-in functions and functions defined in
modules.
Ø User-defined functions are defined only once to perform a particular task but can be executed multiple times
in the same program.
Ø A function call statement is given to execute the statements of a function.
Ø Parameters of a function is the optional list of input value(s) required by the function to perform the required
task.
Ø This list of values given during the function call is the argument(s) list.
Solved Exercise
A. Multiple Choice Questions
1. Which of the following is the correct syntax for using the function sqrt() from math module to find the square root of 25?
a. math import
sqrt(25)
b. import math
sqrt(25)
c. import math
math.sqrt(25)
d. math import
math.sqrt(25)
Modules 287

