C Functions Questions and Answers
Practice ModeShowing 10 of 151 questions
Q121
Function is used to
Answer: Option A
Q122
Find the outputt
void main ( )
{
char c[ ] = "A.P.J";
display (c);
}
display (char *p)
{
while (*p!='\0')
{
if (*p++!='.')
printf("%c",*p);
p++;
}
}
Answer: Option D
Q123
Find the output
void main ( )
{
int i=3, j;
j=add (++i);
printf("%d %d",i,j);
}
add (ii)
int ii;
{
ii++;
printf("%d ",ii);
}
Answer: Option B
Q124
Find the output
void insert ( char a[ ], int n)
{
int i,j;
for (i=j=0; a[i]!='\0';i++)
if (a [i]!=n)
a [j++]=a[i];
a[j]='\0';
}
void main ( )
{
char a[ ] = "justdoit";
insert (a, 't');
printf("%s", a);
}
Answer: Option B
Q125
Find the output
void main ( )
{
int i, n, m, b, x [25];
int f1 (int, int, int j[25]);
for ( i=0; i<25; i++)
x[i]=i;
i=0;m=24;
b=f1 ( i, m, x);
printf("res %d\n", b);
}
int f1(int p, int q, int a[25])
{
int m1, m2;
if (q==0)
return (a[p])'
else
[
m1=f1 (p,q/2, a);
m2=f1 (p+q/2+1, q/2, a);
if (m1<m2)
return (m2);
else
return (m1);
}
}
Answer: Option B
Q126
Function can return at a time
Answer: Option A
Q127
Function prototype is not required if return type is
Answer: Option A
Q128
find the output
void main ( )
{
int x;
x=3;
f (x);
printf ("MAIN");
}
f (int n)
{
printf("F");
if (n !=0)
f (n-1);
}
Answer: Option B
Q129
Find the output
void main ( )
{
auto int i=0;
printf("%d ",i);
{
int i=2;
printf("%d ",i);
{
int i=2;
printf("%d ",i);
{
i+=1;
printf("%d ",i);
}
printf ("%d ",i);
}
printf ("%d ",i);
printf("%d ",ret10 ( ) );
printf("%d ",ret10 ( ) );
}
int ret10 ( )
{
static int i=10;
i+=1;
return (i);
}
Answer: Option D
Q130
Find the output
f (int x, int *y)
{
x=*(y)+=2;
}
void main ( )
{
static int a[5]={2, 4, 6, 8, 10};
int i, b=5;
for (i=0; i<5;i++)
{
f (a[i], &b);
}
printf("%d %d\n", a[i], b);
}
Answer: Option C