FUNCTION (Assignment) Submit Before Mid Term
MCQ
1. What is the output of this statement “printf(“%d”,a++) in C programming?
a. The current value of a
b. The value of a increment by 1
c. Error
d. Garbage
2. Which of the following is a correct format for declaration function?
a. return-type function-name(argument type);
b. return-type function-name(argument type){}
c. return-type (argument type)function name;
d. all of the above
3. Which of the following declaration is illegal?
a. int 1bhk(int);
b. int 1bkt(int a);
c. int 1 bkt(int *, int[])
c. all of the above
Short Answer Question
- What is a function? List out the advantages of functions.
- What do you mean by library function? Differentiate between library function and user defined function.
- What are the different components of functions? Explain.
- What are different types of functions explain with example.
- What is recursive function explain with example
- What do you mean an by storage class? Explain different storage classes with example.
Programs:
- Write a program to calculate the factorial of given number using function.
- Write a program to calculate the factorial of given number using recursive function.
- Write a program to display sum of n even number using function.
- Write a program to display the Fibonacci series up to 10th term by using recursive function.
- Write a program to enter a radius of a circle and display its area using user defined function.
- Write a program to check whether the entered number is prime number or not using function.
- Write a program using a user defined function to calculate y raise to power x.
- Write a program to enter 2X2 matrices, pass them in a function and display the matrix.
- Write a program to print transpose of matrix (2×2 type) using array and function.
- Write a program to enter two 3×3 matrices, pass them in a function and find their sum.