C Programming 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.

advertisement

1. Which of the following mathematical function requires 2 parameter for successful function call?
a) fmod();
b) div();
c) atan2();
d) all of the mentioned
View Answer

Answer: d
Explanation: None.

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

Answer: c
Explanation: None.
advertisement
advertisement

3. What will 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
View Answer

Answer: a
Explanation: None.

4. What will cos(x) return?
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
View Answer

Answer: c
Explanation: None.
advertisement

5. What will be the output of the following C code?

  1.     #include <stdio.h>
  2.     #include <math.h>
  3.     void main()
  4.     {
  5.         int k = pow(2, 3);
  6.         printf("%d\n", k);
  7.     }

a) 9
b) 8
c) -1
d) 6
View Answer

Answer: b
Explanation: None.
advertisement

6. What will be the output of the following C code?

advertisement
  1.     #include <stdio.h>
  2.     #include <math.h>
  3.     void main()
  4.     {
  5.         int k = fabs(-87);
  6.         printf("%d\n", k);
  7.     }

a) -87
b) 87
c) 78
d) error
View Answer

Answer: b
Explanation: None.

7. What will be the output of the following C code?

  1.     #include <stdio.h>
  2.     #include <math.h>
  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
View Answer

Answer: d
Explanation: None.

8. 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);
View Answer

Answer: a
Explanation: None.

Sanfoundry Global Education & Learning Series – C Programming Language.

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!

advertisement
advertisement

Leave a Comment

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn | Youtube | Instagram | Facebook | Twitter

Check his free tutorial videos on Advanced C Programming. Join his Sanfoundry-Classes telegram channel for all videos and queries on Programming, Data-Structures, Kernel, Personality development and Mentoring.