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. Which of the following header declares mathematical functions and macros?
a) math.h
b) assert.h
c) stdmat. h
d) stdio. h
View Answer
Explanation: The header file math.h declares all the mathematical functions and macros.
2. All the functions in this library take as a parameter and return as the output.
a) double, int
b) double, double
c) int, double
d) int, int
View Answer
Explanation: All the function in this math library takes double as a parameter and gives double as the result.
3. HUGE_VAL macro is used when the output of the function may not be ___________
a) floating point numbers
b) integer number
c) short int
d) long int
View Answer
Explanation: HUGE_VAL macro is used when the result of a function may not be representable as a floating point number.
4. What error occurs if an input argument is outside the domain over which the mathematical function is defined?
a) domain error
b) range error
c) no error
d) domain and range error
View Answer
Explanation: A domain error occurs if an input argument is outside the domain over which the mathematical function is defined.
5. A range error occurs if the result of the function cannot be represented as a value.
a) int
b) short int
c) double
d) float
View Answer
Explanation: if the result of the function cannot be represented as a double value, a range error occurs. If the result overflows (the magnitude of the result is so large that it cannot be represented in an object of the specified type), the function returns the value of the macro HUGE_VAL, with the same sign as the correct value of the function.
6. If the result overflows, the function returns the value of the macro HUGE_VAL, carrying the same sign except for the _________ function as the correct value of the function.
a) sin
b) cos
c) cosec
d) tan
View Answer
Explanation: If the result overflows i.e the magnitude of the result is too large to be represented in an object of the specified type, the function returns the value of the macro HUGE_VAL, with the same sign except for the tan function as the correct value of the function.
7. If the result underflow, the function returns zero.
a) true
b) false
View Answer
Explanation: If the result underflows i.e the magnitude of the result is very small to be represented in an object of the specified type, the function returns zero.
8. For the given math function, an error occurs if the arguments are not in the range [-1, +1].
double acos(double x);
a) range error
b) domain error
c) no error
d) domain and range error
View Answer
Explanation: The acos() function is used to compute the principal value of the inverse of cosine of x. A domain error occurs for arguments not in the range [-1, +1].
9. Which function returns the arc sine in the range [-pi/2, +pi/2] radians?
a) arcsin()
b) asin()
c) sin()
d) asine()
View Answer
Explanation: The asin() function is used to compute the principal value of the inverse of sine of x. A domain error occurs for arguments not in the range [-1, +1].
10. What will be the output of the following C code?
double x, deg, rad; x = 1.0; val = 180.0 / 3.14; deg = atan (x) * val; printf("The arc tangent of %lf is %lf degrees", x, deg);
a) The arc tangent of 1.000000 is 45.000000 degrees
b) The arc tangent of 1.000 is 45.000degrees
c) The arc tangent of 1 is 45 degrees
d) The arc tangent of 1.0000is 45.0000degrees
View Answer
Explanation: double atan(double x) returns the arc tangent of x in radians.
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.
- Check Computer Science Books
- Apply for Computer Science Internship
- Apply for C Internship
- Watch Advanced C Programming Videos
- Practice Computer Science MCQs