C Programming - Functions
Exercise : Functions - Point Out Correct Statements
- Functions - General Questions
- Functions - Find Output of Program
- Functions - Point Out Errors
- Functions - Point Out Correct Statements
- Functions - True / False Questions
- Functions - Yes / No Questions
1.
Which of the following statements are correct about the program?
#include<stdio.h>
int main()
{
printf("%p\n", main());
return 0;
}
Answer: Option
Explanation:
In printf("%p\n", main()); it calls the main() function and then it repeats infinetly, untill stack overflow.
2.
There is a error in the below program. Which statement will you add to remove it?
#include<stdio.h>
int main()
{
int a;
a = f(10, 3.14);
printf("%d\n", a);
return 0;
}
float f(int aa, float bb)
{
return ((float)aa + bb);
}
Answer: Option
Explanation:
The correct form of function f prototype is float f(int, float);
3.
Which of the following statements are correct about the function?
long fun(int num)
{
int i;
long f=1;
for(i=1; i<=num; i++)
f = f * i;
return f;
}
Answer: Option
Explanation:
Yes, this function calculates and return the factorial value of an given integer num.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers