Functions 351
EXERC ISES
A)Answer the following questions.
1) Write the definition of a function. Indicate types of functions available in C.
2) How does a function help to reduce the program size?
3) Differentiate between library and user-defined functions.
4) How does a function work? Explain how arguments are passed and results are returned?
5) List any five library functions and illustrate them with suitable examples.
6) What are actual and formal arguments?
7) What are the uses of re t u rn () statements?
8) What does it mean if there is no return statement in the function?
9) What are void functions?
10) Why is it possible to use same variable names for actual and formal arguments?
11) What is the main () function in C? Why is it necessary in each program?
12) Explain the different formats of re tu rn () statements. How many values return statement
returns at each call?
13) What is a global pointer? Illustrate with a suitable example.
14) W hy is the return statement not necessary when a function is called by reference?
15) Distinguish between function prototype and function definition
16) Should the function prototype should match with the function definition?
17) Can we define a user-defined function with the same library function name?
18) What is recursion? Explain its advantages.
19) Explain types of recursions.
20) Is it possible to call a library function recursively?
B) Answer the following by selecting the appropriate option.
1) Arrays are passed as arguments to a function by
a) value
b) reference
c) both (a) and (b)
d) of the above
2) It is necessary to declare the type of a function in the calling program if
a) the function returns a non-integer value
b) the function returns an integer
c) function is not defined in the same file
d) none of the above
3) Recursion is a process in which a function calls
a) itself
b) another function
c) main () function
d) none of the above