A. Explain The Role of Static Variable B. Explain Working of This Code With Its Output? (1+ 3 Marks)
A. Explain The Role of Static Variable B. Explain Working of This Code With Its Output? (1+ 3 Marks)
A. Explain The Role of Static Variable B. Explain Working of This Code With Its Output? (1+ 3 Marks)
Name:.......................................................Roll No.......................................
}
a. Explain the role of static variable
b. Explain working of this code with its output? (1+ 3 Marks)
1
2. Consider the following C declaration
struct {
short s [5]
union {
float y;
long z;
}u;
} t;
3. Consider the following three C functions as P1, P2, P3. Explain what each of these functions
are performing. Will they work properly or not explain with specific reason. Give Justification
of return value (IF THEY WORK) for each function individually. (3 Marks)
2
4. Consider the following C function
void swap (int a, int b)
{
int temp;
temp = a;
a = b;
b = temp;
}
In order to exchange the values of two variables x and y what are the correct options from given
below. Give Justification for each option (4 Marks)
i. call swap (x, y)
ii. call swap (&x, &y)
iii. swap (x,y) cannot be used as it does not return any value
iv. swap (x,y) cannot be used as the parameters are passed by value
3
Write a function calculate which takes an array of n element and return its sum,
average and maximum (without using structure and array for these values). Write
complete program including function calling. (7 marks)