C Programming Multiple Choice Questions and Answers on Mathematical Functions for Freshers

1. What is the output of this C code?
  1.     #include 
  2.     #include 
  3.     int main()
  4.     {
  5.         int i = 90;
  6.         printf("%f\n", sin(i));
  7.         return 0;
  8.     }
a) Compile time error
b) Undefined behaviour
c) 0.893997
d) 1.000000
Answer: a
2. What is the output of this C code?
  1.     #include 
  2.     #include 
  3.     int main()
  4.     {
  5.         unsigned int i = -1;
  6.         printf("%f\n", fabs(i));
  7.         return 0;
  8.     }
a) Compile time error
b) 1
c) -1
d) None of the mentioned
Answer: d
3. function fabs defined math.h header file takes argument of type integer.

a) True
b) False
c) Depends on the implementation
d) Depends on the standard
Answer: b
4. log(x) function defined in math.h header file is

a) Natural base logarithm
b) Logarithm to the base 2
c) Logarithm to the base 10
d) None of the mentioned
Answer: a
5. What is the output of this C code?
  1.     #include 
  2.     #include 
  3.     int main()
  4.     {
  5.         int i = 10;
  6.         printf("%f\n", log10(i));
  7.         return 0;
  8.     }
a) Compile time error
b) 1.000000
c) 2.302585
d) None of the mentioned
Answer: b
6. What type of inputs are accepted by mathematical functions?

a) short
b) int
c) float
d) double
Answer: d
7. In linux, apart from including math header file, the program is successfully executed by which of the following?

a) cc filename.c
b) cc filename.c -lc
c) cc -math filename.c
d) cc -lm filename.c
Answer: d
8. Which of the following is not a valid mathematical function?

a) frexp(x);
b) atan2(x,y);
c) srand(x);
d) fmod(x);
Answer: d
9. Which of the following mathematical function requires 2 parameter for successful function call?

a) fmod();
b) div();
c) atan2();
d) all of the mentioned
Answer: d
10. Which mathematical function among the following does NOT require int parameters?

a) div(x, y);
b) srand(x);
c) sqrt(x);
d) all of the mentioned
Answer: c
11. sin(x) returns

a) sine of x where x is in radians
b) sine of x where x is in degree
c) cosine of x where x is in radians
d) cosine of x where x is in degree
Answer: a
12. cos(x) returns

a) sine of x where x is in radians
b) sine of x where x is in degree
c) cosine of x where x is in radians
d) cosine of x where x is in degree
Answer: c
13. What is the output of this C code?
  1.     #include 
  2.     #include 
  3.     void main()
  4.     {
  5.         int k = pow(2, 3);
  6.         printf("%d\n", k);
  7.     }
a) 9
b) 8
c) -1
d) 6
Answer: b
14. What is the output of this C code?
  1.     #include 
  2.     #include 
  3.     void main()
  4.     {
  5.         int k = fabs(-87);
  6.         printf("%d\n", k);
  7.     }
a) -87
b) 87
c) 78
d) error
Answer: b
15. What is the output of this C code?
  1.     #include 
  2.     #include 
  3.     void main()
  4.     {
  5.         int k = sqrt(-4);
  6.         printf("%d\n", k);
  7.     }
a) -2
b) 2
c) Compile time error
d) NaN
Answer: d
16. Which among the following mathematical function do not have a “double” return-type?

a) srand(x);
b) ceil(x);
c) floor(x);
d) both ceil(x); and floor(x);
Answer: a

Related

Computer Fundamentals Multiple choice Questions and Answers on Software Testing for Freshers

1. A set of activities that ensure that software correctly implements a specific function. a) verificationb) testingc) implementationd) validation Answer: a Explanation: Verification ensures that...

Computer Fundamentals Multiple choice Questions and Answers on Waterfall Model for Freshers

1. A model that is the demo implementation of the system. a) waterfallb) prototypec) incrementald) agile Answer: b Explanation: Prototype is the demo implementation so that the customer gets a br...

Computer Fundamentals Multiple choice Questions and Answers on Augmented Reality for Freshers

1. A field of technology that deals with a combination of real world and the data generated from computer. a) MLb) AIc) ARd) IoT Answer: c Explanation: AR that is Augmented Reality is a field of ...

Post a Comment

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

item