Q.3 Describe about static and external variables. Answer: - External variables
have global scope across the entire program (provided extern declarations are used is files other than where the variable is defined), and a lifetime over the the entire program run. The storage class, static, similarly provides a lifetime over the entire program, however; it provides a way to limit the scope of such variables, and Static storage class is declared with the keyword static as the class specifier when the variable is defined. These variables are automatically initialized to zero upon memory allocation just as external variables are. Static storage class can be specified for automatic as well as external variables.
Q.4 Distinguish between pass by value and pass by reference with the help of an example. Answer: -
When passing parameters, what it is called and what happens can be confusing. It is less essential that you call it the "correct" thing than you know exactly what is happening. It is critical to have a good mental model, a valid memory picture of the process. Recall that when you call a function, a chunk of memory called an activation record is allocated. Critical to the discussion here is that this memory holds the formal parameter values and function local variables.
Q.5 Define macro. How can we declare a macro statement? Explain with an example. Answer: -
A Macro is typically an abbreviated name given to a piece of code or a value. Macros can also be defined without any value or piece of code but in that case they are used only for testing purpose.
Defining Macros without values
Q.6 What is the use of fopen () and fclose () function? List and explain different modes for opening a file.
Answer: - fopen function ():-
function is used to open the file.
Dear students get fully solved SMU MBA Spring 2014 assignments Send your semester & Specialization name to our mail id :