User defined functions

Jan 11 • Resources • 12801 Views • 23 Comments on User defined functions

Ques 1. What is the difference between user defined function and library function?
Answer. User Defined Functions has to be Developed by the user at the time of writing a program like Main() while library defined functions are already defined in the library of C and cannot be further modified like Printf().

Ques 2. What are the advantages of user-defined function?
Answer. Following are the advantages of user-defined function:-
1. It Facilitates top down programming.
2. It can be used by any other program.
3. Length of program can be reduced and makes debugging easier.

Ques 3. What are the elements of user-defined function?
Answer. There are three elements of user-defined function. These elements are as follows:-
1. FUNCTION DEFINITION
2. FUNCTION CALL
3. FUNCTION DECLARATION

Ques 4. What are the elements of function definition?
Answer. Function Definition shall include the following elements:-

function definition

Elements of Function Definition

1. FUNCTION NAME
2. FUNCTION TYPE.
3. LIST OF PARAMETERS
4. LOCAL VARIABLE DECLARATION
5. FUNCTION STATEMENT
6. RETURN STATEMENT.

Ques 5. What are the similarities between variables and functions?
Answer. They both have the following similarities:-
1. They both adhere to the rule of Identifier.
2. Both have a type associated with it.
3. Their type must be declared and defined before they are used.

Ques 6. What are the different categories of a function?
Answer. The different categories of a function are:-
1. FUNCTION WITH NO ARGUMENT AND NO RETURN VALUE.
2. FUNCTION WITH ARGUMENT AND NO RETURN VALUE.
3. FUNCTION WITH ARGUMENT AND ONE RETURN VALUE.
4. FUNCTION WITH NO ARGUMENT BUT RETURN A VALUE.
5. FUNCTION THAT RETURN MULTIPLE VALUE.

Ques 7. What are the rules for passing an array to a function?
Answer. There are three different rules for passing an array to a function:-
1. The function must be called by passing the name of an array.
2. In function definition the size of the array does not need to be specified.
3. The function prototype must show that the argument is in array.

Ques 8. What is the difference between Automatic variable and static variable?
Answer. Automatic variables are created when an already existing function is called and destroyed automatically while the Static variable can be declared anywhere in the program by using static keyword.

Ques 9. What are the different ways of parameter passing?
Answer. There are two different ways of passing data from one function to another:-
1. Pass by Value:-Actual parameter are copied to the variable in the parameter list of the called function.
2. Pass by Reference:-Memory address of the variable are sent to the called function.

Ques 10. What is the difference between global prototype and local prototype?
Answer. When we place the declaration above all the function it is called global prototype while when the prototype is in the function definition it is called local prototype.

If you like to download the questions and answers on User Defined Functions in pdf, then click here QUESTIONS ON USER DEFINED FUNCTIONS.pdf

Related Links-
Format Function: Basic Concepts
Functions in C Language


Discover more from Our Education | Best Coaching Institutes Colleges Rank

Subscribe to get the latest posts sent to your email.

Tell us Your Queries, Suggestions and Feedback

Your email address will not be published. Required fields are marked *

23 Responses to User defined functions

  1. sourav bairwa says:

    bca

  2. sourav bairwa says:
  3. bhoma ram says:

    bca first year

  4. bhoma ram says:

    bca first year

  5. bhoma ram says:

    bca first year

  6. bhoma ram says:

    bca first year

  7. bhoma ram says:

    bca first year

  8. bhoma ram says:

    bca first year

  9. bhoma ram says:

    bca first year

  10. bhoma ram says:

    bca first year

  11. Anonymous says:
  12. S.karishma says:

    Syntax of user defined function

  13. Junia Arinze says:

    I just need help on user defined functions in C.

  14. Nagarajan says:

    C language user define function question and answer.

  15. Nagarajan says:
  16. Ritika says:

    Basic difference between User defined & Library Questions!

  17. Ankita Sharma says:

    HELPFUL Article. for interviews n basic knowldge.:)

  18. Ankita Prajapati says:

    This article gives complete idea about the questions that can be asked in interview ..

  19. Siddhant Tripathi says:

    User defined functions are handy with pointers and allocations over C.. understanding the concepts and applications of it.

  20. saurabh singh says:

    User defined functions are those that were developed by the programmer if it is required by the program at that time.This article gives brief but necessary information regarding “User defined functions”.

  21. BHARTI PANDEY says:

    A COMPLETE EXHAUSTIVE article on the USER DEFINED FUNCTIONS which are defined by the user as per Requirement….Really Useful in Clearing my Concepts…

  22. Dolly Gupta says:

    User defined functions are those functions that are defined by the user according to there needs and requirements. These are not the inbuilt functions.

  23. sakshi chaudhary says:

    User defined functions are developed by the user according to their requirements in a context where the usual assumption is that functions are built into the program or environment. Above questions help to understand how User defined functions can work and the leading advantages of it….

« »