Mathematical Functions MCQ Questions - C Programming
This section focuses on the "Mathematical Functions" in C programming. These Multiple Choice Questions (MCQ) should be practiced to improve the C programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.
1. C Programming allows us to perform mathematical operations through the functions defined in ______________ header file.
A. iostream.h
B. string.h
C. math.h
D. conio.h
View Answer
Ans : C
Explanation: C Programming allows us to perform mathematical operations through the functions defined in math.h header file.
2. Which of the following is correct mathematical operations in C Programming?
A. sqrt
B. pow
C. ceil
D. All of the above
View Answer
Ans : D
Explanation: The math.h header file contains various methods for performing mathematical operations such as sqrt(), pow(), ceil(), floor() etc.
3. Which of the following returns the square root of given number?
A. ceil
B. sqrt
C. floor
D. abs
View Answer
Ans : B
Explanation: sqrt(number): returns the square root of given number.
4. abs(number) returns the absolute value of given number.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True, abs(number) returns the absolute value of given number.
5. Which of the following is true about pow?
A. rounds down the given number
B. rounds up the given number
C. returns the power of given number
D. returns the absolute value of given number
View Answer
Ans : C
Explanation: pow(base, exponent) returns the power of given number.
6. The cos function computes the cosine of x.
A. measured in degrees
B. measured in radians
C. measured in gradian
D. measured in milliradian
View Answer
Ans : B
Explanation: The cos function computes the cosine of x (measured in radians).
7. A function is declared as sqrt(-x) under the header file math.h, what will the function return?
A. square root of x
B. complex number
C. domain error
D. range error
View Answer
Ans : C
Explanation: The sqrt function computes the nonnegative square root of x. A domain error occurs if the argument is negative.
8. HUGE_VAL macro is used when the output of the function may not be ___________
A. integer number
B. short int
C. long int
D. floating point numbers
View Answer
Ans : D
Explanation: HUGE_VAL macro is used when the result of a function may not be representable as a floating point number.
9. The C library function double fmod(double x, double y) returns the remainder of x divided by y.
A. log10(double x, double y)
B. fabs(double x, double y)
C. fmod(double x, double y)
D. floor(double x, double y)
View Answer
Ans : C
Explanation: double fmod(double x, double y) : The C library function double fmod(double x, double y) returns the remainder of x divided by y.
10. All the functions available in this library take double as an argument and return double as the result.
A. Yes
B. No
C. Can be yes or no
D. Can not say
View Answer
Ans : A
Explanation: Yes, All the functions available in this library take double as an argument and return double as the result.
Discussion