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
View Answer

Answer: c
Explanation: The atan2 function returns the arc tangent of y/x, in the range [-pi,+pi] radians.
advertisement
advertisement

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

Answer: a
Explanation: The cos function computes the cosine of x (measured in radians).
Note: Join free Sanfoundry classes at Telegram or Youtube

3. The function computes the hyperbolic cosine of x.
a) cos(x)
b) cosine(x)
c) cosh(x)
d) cosineh(x)
View Answer

Answer: c
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

Answer: b
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).
advertisement

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

Answer: a
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

Answer: b
Explanation: The frexp() function breaks a floating-point number into a normalized fraction and an integral power of 2.
advertisement

7. The function computes the exponential function of x.
a) exp(x)
b) frexp(x)
c) frexp x
d) exp x
View Answer

Answer: d
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

Answer: a
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

Answer: c
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

Answer: a
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.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.