C Functions Questions and Answers
Practice ModeShowing 10 of 151 questions
Q111
Every function internally creates
Answer: Option B
Q112
Find the output
void main ( )
{
void show (int);
int n=1000;
show (n);
}
void show (int x)
{
if (x !=0)
{
show (x/16);
putchar("0123456789ABCDEF" [x%16]);
}
else
return 0;
}
Answer: Option C
Q113
Find the correct output
void main( )
{
int n=5;
printf("%d",f(n));
}
int f(int n)
{
if (n>0)
return (n+f(n-2));
else
return 0;
}
Answer: Option A
Q114
Find the output
void main ( )
{
int a [ ]={1, 2, 3, 4};
int i, s=0;
for (i=0; a[i];i++)
s+=add (a[i]);
printf("%d",s);
}
int add (int a)
{
static int d=1;
return (a/d++);
}
Answer: Option A
Q115
The function strcmp(s1,s2) returns negative value if
Answer: Option A
Q116
Find the output
fun ( )
{
printf("Y");
}
#define fun () printf ("N")
void main ( )
{
fun ( );
(fun) ( );
}
Answer: Option B
Q117
Find the output
void main ( )
{
int a=5, b=10;
swap (a,b);
printf("%d %d", b, a);
}
swap (int x, int y)
{
int t=-x;
-x=-y;
y=t;
}
Answer: Option D
Q118
Find the output
void main ( )
{
void evaluate (int *);
int a[3] [3]={{0,}, {2,3}, {4, 5}};
evaluate ((int *)a);
}
void evaluate (int *e)
{
printf ("%d", * (e+3));
}
Answer: Option B
Q119
Find the output
void main ( )
{
int x;
x=compute (4);
printf("%d",x);
}
int compute (int n)
{
if (n<=1)
return 2;
else
return (compute (n-2)*
compute (n-1));
}
Answer: Option D
Q120
Which memory variable share the memory location in different fframes in function recursion
Answer: Option B