C Functions Questions and Answers
Practice ModeShowing 10 of 151 questions
Q51
what will be result of the following program ?
main ( )
{
void f (int, int);
int i = 10;
f (i, i++);
}
void f(int i, intj)
{
if (i >50)
return;
i+=j;
f (i, j);
printf ("%d, ", i);
}
Answer: Option D
Q52
What is the output of the following code ?
main ( )
{
printf ("%d\n", sum (5));
}
int sum (int n)
{
if (n<1) return n;
else return (n + sum (n-1));
}
Answer: Option D
Q53
What is the output generated by the following program ?
# include <stdio.h>
main ( )
{
int i, x;
for (i = 1, i<=5; i++)
{
x = sq (i);
printf ("%d",x);
}
}
sq (int x)
{
return x*x;
}
Answer: Option D
Q54
What is the output of the following code ?
int n = -24;
main ( )
{
printd (n);
}
printd (int n)
{ if (n < 0)
{
ptintf ("-");
n = -n;
}
if (n % 10 ) printf ("%d", n);
else printf ("%d", n/10);
printf ("d", n);
}
Answer: Option C
Q55
What is the output of the following code ?
main ( )
{
int x = 80, a= -80
void swap (intt, int);
swap (x, a);
printf ("numbers are %d\t%d", a, x),
}
void swap (int y, int b)
{
int t=y;
y = b;
b = t;
}
Answer: Option C
Q56
Which storage class can precede any data type in the parameter list ?
Answer: Option C
Q57
Which of the following is true about functions ?
Answer: Option D
Q58
Which of the following storage classes are used for function declaration ?
Answer: Option D
Q59
Which of the following is not used for termination of recursion?
Answer: Option C
Q60
Find the output
void main ()
{
printf("%u", main );
}
Answer: Option C