This set of C Multiple Choice Questions & Answers (MCQs) focuses on “Mathematical Functions – 2”.
Pre-requisite for this C MCQ set: Advanced C Programming Video Tutorial.
1. What does the given C code do?
double atan2 (double y, double x);
a) The atan2 function returns the arc tangent of x/y
b) The atan2 function returns the arc tangent of x
c) The atan2 function returns the arc tangent of y/x
d) The atan2 function returns the arc tangent of y
View Answer
Explanation: The atan2 function returns the arc tangent of y/x, in the range [-pi,+pi] radians.
2. The cos function computes the cosine of x.
a) measured in radians
b) measured in degrees
c) measured in gradian
d) measured in milliradian
View Answer
Explanation: The cos function computes the cosine of x (measured in radians).
3. The function computes the hyperbolic cosine of x.
a) cos(x)
b) cosine(x)
c) cosh(x)
d) cosineh(x)
View Answer
Explanation: The cosh() function computes the hyperbolic cosine of x. The cosh function returns the hyperbolic cosine value.
4. What error occurs if the magnitude of x is too large in sinh(double x)?
a) domain error
b) range error
c) no error
d) zero is returned
View Answer
Explanation:The sinh() function computes the hyperbolic sine of x. A range error occurs if the magnitude of x is too large.If the result overflows i.e the magnitude of the result is too large to be represented in an object of the specified type).
5. Which of the following is the correct code?
a) tanh(double x)
b) tanh double x
c) tanhdouble x
d) tanhdoublex
View Answer
Explanation: The correct code is tanh(double x). The tanh() function computes the hyperbolic tangent of x.
6. Name the function that breaks a floating-point number into a normalized fraction and an integral power of 2.
a) exp()
b) frexp()
c) Idexp()
d) modf()
View Answer
Explanation: The frexp() function breaks a floating-point number into a normalized fraction and an integral power of 2.
7. The function computes the exponential function of x.
a) exp(x)
b) frexp(x)
c) frexp x
d) exp x
View Answer
Explanation: The exp(x) function computes the exponential function of x.
8. The ldexp() function multiplies a floating-point number by an integral power of 2.
a) true
b) false
View Answer
Explanation: double ldexp(double x, int exp);
The ldexp function multiplies a floating-point number by an integral power of 2. A range error may occur. The ldexp() function returns the value of x times 2 raised to the power exp.
9. What will be the output of the following C code?
double log (double -x);
a) returns natural logarithm of x
b) range error
c) domain error
d) returns natural logarithm of -x
View Answer
Explanation: The log() function is used to compute the natural logarithm of x. If the argument is negative, a domain error occurs. A range error may occur if the argument is zero.
10. Which of the given function is a library function under the header math.h?
a) log10()
b) log20()
c) log30()
d) log50()
View Answer
Explanation: double log10 (double x);
The log10 function computes the base-ten logarithm of x. If the argument is negative, a domain error occurs. If the argument is zero, a range error may occur.
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.
- Get Free Certificate of Merit in C Programming
- Participate in C Programming Certification Contest
- Become a Top Ranker in C Programming
- Take C Programming Tests
- Chapterwise Practice Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Chapterwise Mock Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Practice BCA MCQs
- Apply for Computer Science Internship
- Buy Computer Science Books
- Apply for C Internship
- Practice Computer Science MCQs