C- Functions Question and Answer
C- Functions Question and Answer
81. size of a function is known as
- Function call
- function Recursion
- function Frame
- Function prototype
84. Find the output
void main ( )
{
int x=10, y=20, p,q;
p=add (x,y);
q=add (x,y);
printf("%d %d", p,q);
}
add (int a, int b)
{
a+=a; b+=b;
return (a);
return (b);
}
void main ( )
{
int x=10, y=20, p,q;
p=add (x,y);
q=add (x,y);
printf("%d %d", p,q);
}
add (int a, int b)
{
a+=a; b+=b;
return (a);
return (b);
}
- 10 10
- 20 20
- 10 20
- 20 10
85. Forward communication is only possible through
- Pass by value
- Pass by address
- Return type
- Both a and b
86. storage class of a function is defined when
- Function prototype is declared
- Function body is defined
- Function call
- None of these
87. Find the output
void main ()
{
int x=5, y=6;
change (&x, &y);
prrintf("%d %d", x,y);
}
change (int *x, int *y)
{
int temp=1;
temp^=*x;
*x^=*y;
*y^=temp;
}
void main ()
{
int x=5, y=6;
change (&x, &y);
prrintf("%d %d", x,y);
}
change (int *x, int *y)
{
int temp=1;
temp^=*x;
*x^=*y;
*y^=temp;
}
- 5 6
- 6 5
- 3 2
- None of these
88. Find the output
void main ()
{
int i=2;
printf("%d", see (i));
}
see (i)
{
return i*i;
}
void main ()
{
int i=2;
printf("%d", see (i));
}
see (i)
{
return i*i;
}
- Compilation error
- 2
- 4
- None of these
89. Which of the following is true?
- Nested function call is allowed in C.
- The functions should be called in the order of their definitions in the source code.
- C follows bottom-up modular approach.
- A function name can begin with an underscore
90. Find the output
void main ()
{
int x[5];
see (x);
printf("%d", x[2]);
}
see (int x[ ] )
{
x++;
x[1]=100;
}
void main ()
{
int x[5];
see (x);
printf("%d", x[2]);
}
see (int x[ ] )
{
x++;
x[1]=100;
}
- 100
- 0
- Garbage
- None of these