About Me

My photo
Vijayapur, Karnataka, India
I am interested in Teaching.

Sunday 23 April 2017

Assignments on Functions (Assignment -IV)

1. What is function? Write its advantages with one programming example.

2. What is the difference between built-in and user defined function?

3. Discuss the "Elements of User Defined Functions" with explanation, syntax and examples.

4. Write user defined functions for following.
   
    To find sum of two integers.   i.e. sum(n1,n2)
    To find area of circle.              i.e. ac(r)
    To find factorial of 'n'              i.e. fact(n)
    To find largest of two numbers i.e. large(n1,n2)
    To find largest of three numbers i.e. max(n1,n2,n3)
    To find square and cube of a number. (Write two functions square(n) and cube(n) and call in main())
     To check, whether the number is prime or not prime i.e. by creating your own functions as isprime(n) that reurns 1 if the number is prime;otherwise, 0.

5. List and discuss categories of functions with programming examples.
   functions with arguments and return values.
   functions with no arguments and return values.
   functions with arguments and no return values.
   functions with no arguments and no return values.

6. What are actual and formal parameters? Discuss with example.

7. What is recursive function? Give programming example. i.e. Write recursive function to find factorial of 'n'. (vimp)

8. Discuss "Parameter Passing Mechanisms" with programming examples. (call by value and call by reference)) (vvimp)

9. Write difference between "call by value" and "call by reference" methods.

10. Write user defined function to swap the contents of two variables using call by reference(address) method. (vvimp)

11. Discuss storage classes used in C. i.e. auto, global, static and register variables. (vimp)









No comments:

GCD of two numbers and its application...

The greatest common divisor (gcd) of two numbers is the largest positive integer that divides both numbers without leaving a remainder. The ...