Computer
Science
WORKING WITH FUNCTIONS :
Q1. What is a function ?
A function is a subprogram that acts on data and often returns a value .
Function make program handling easier as only a small part of the program
is dealt with at a time, thereby avoiding ambiguity . Using functions reduces
program size .
Q2. What is the significance of having functions in a program ?
Creating funtions in programs is very useful . It offers following advantages :
The program is easier to understand .
Main block of program becomes compact as the code of functions is not
part of it, thus is easier to read and understand .
Redundant code is at one place, so making changes is easier .
Instead of writing code again when we need to use it more than
once, we can write the code in the form of a function and call it
more than once . If we later need to change the code, we change it in
one place only. Thus it saves our time also .
Reusable functions can be put in a library in modules .
We can store the reusable functions in the form of modules . These
modules can be imported and used when needed in other programs.
Q3. What do you understand by flow of execution ?
The order of execution of statement during a program run . It basically refers
to the order in which statements are executed . Execution always starts at
the first statement of the program . Moreover, statements execute one at a
time . It happens in order, from top to bottom .
Q4.