This set of C Multiple Choice Questions & Answers (MCQs) focuses on “Mathematical Functions – 1”.
Pre-requisite for this C MCQ set: Advanced C Programming Video Tutorial.
1. What will be the output of the following C code?
#include <stdio.h>
#include <math.h>
int main()
{
int i = 90;
printf("%f\n", sin(i));
return 0;
}
a) Compile time error
b) Undefined behaviour
c) 0.893997
d) 1.000000
View Answer
Explanation: None.
2. What will be the output of the following C code?
#include <stdio.h>
#include <math.h>
int main()
{
unsigned int i = -1;
printf("%f\n", fabs(i));
return 0;
}
a) Compile time error
b) 1
c) -1
d) None of the mentioned
View Answer
Explanation: None.
3. function fabs defined math.h header file takes the argument of type integer.
a) True
b) False
c) Depends on the implementation
d) Depends on the standard
View Answer
Explanation: None.
4. log(x) function defined in math.h header file is __________
a) Natural base logarithm
b) Logarithm to the base 2
c) Logarithm to the base 10
d) None of the mentioned
View Answer
Explanation: None.
5. What will be the output of the following C code?
#include <stdio.h>
#include <math.h>
int main()
{
int i = 10;
printf("%f\n", log10(i));
return 0;
}
a) Compile time error
b) 1.000000
c) 2.302585
d) None of the mentioned
View Answer
Explanation: None.
6. What type of inputs are accepted by mathematical functions?
a) short
b) int
c) float
d) double
View Answer
Explanation: None.
7. In linux, apart from including math header file, the program is successfully executed by which of the following?
a) cc filename.c
b) cc filename.c -lc
c) cc -math filename.c
d) cc -lm filename.c
View Answer
Explanation: None.
8. Which of the following is not a valid mathematical function?
a) frexp(x);
b) atan2(x,y);
c) srand(x);
d) fmod(x);
View Answer
Explanation: None.
Sanfoundry Global Education & Learning Series – C Programming Language.
To practice all areas of C language, here is complete set of 1000+ Multiple Choice Questions and Answers.
If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]
- Watch Advanced C Programming Videos
- Check Computer Science Books
- Apply for C Internship
- Practice Computer Science MCQs
- Apply for Computer Science Internship