8. B) Define a function. List various advantages of a function.
Answers:-
“Functions are independent program modules that are designed to carry out a particular
task.”
In functions we have two types:
- Built-in (Library) functions
- User-defined functions
Advantages of using Functions:
1. Managing huge programs and software packages is easier by dividing them into functions/modules—Maintenance is easier
2. Error detection is easier—Debugging is easier
3. Functions are once written can be reused in any other applications – Reusability is enhanced
4. We can protect our data from illegal users—Data protection becomes easier