0% found this document useful (0 votes)
5 views3 pages

Viva Questions

The document outlines key concepts related to user-defined functions and their advantages, including elements such as function definition, call, and declaration. It distinguishes between user-defined and library functions, discusses categories of functions, and explains rules for passing arrays and differences between variable types. Additionally, it covers parameter passing methods and the distinction between global and local prototypes.

Uploaded by

Garima Agrawal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

Viva Questions

The document outlines key concepts related to user-defined functions and their advantages, including elements such as function definition, call, and declaration. It distinguishes between user-defined and library functions, discusses categories of functions, and explains rules for passing arrays and differences between variable types. Additionally, it covers parameter passing methods and the distinction between global and local prototypes.

Uploaded by

Garima Agrawal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

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 Cand 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:-

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.

You might also like