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:-
![User defined functions function definition](http://mathbits.com/MathBits/CompSci/functions/func2.gif)
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
Tell us Your Queries, Suggestions and Feedback
23 Responses to User defined functions
« Important questions on GSM India defeat Pakistan in 2013 »
bca
bca first year
bca first year
bca first year
bca first year
bca first year
bca first year
bca first year
bca first year
Syntax of user defined function
I just need help on user defined functions in C.
C language user define function question and answer.
Basic difference between User defined & Library Questions!
HELPFUL Article. for interviews n basic knowldge.:)
This article gives complete idea about the questions that can be asked in interview ..
User defined functions are handy with pointers and allocations over C.. understanding the concepts and applications of it.
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”.
A COMPLETE EXHAUSTIVE article on the USER DEFINED FUNCTIONS which are defined by the user as per Requirement….Really Useful in Clearing my Concepts…
User defined functions are those functions that are defined by the user according to there needs and requirements. These are not the inbuilt functions.
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….