# C Questions and Answers – Mathematical Functions – 2

«
»

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

Explanation: The atan2 function returns the arc tangent of y/x, in the range [-pi,+pi] radians.
Note: Join free Sanfoundry classes at Telegram or Youtube

2. The cos function computes the cosine of x.
b) measured in degrees

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)

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

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 speciﬁed type).

5. Which of the following is the correct code?
a) tanh(double x)
b) tanh double x
c) tanhdouble x
d) tanhdoublex

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()

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

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

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

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()

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. 