C Programming Questions and Answers – Precedence and Order of Evaluation – 3

This set of C Multiple Choice Questions & Answers (MCQs) focuses on “Precedence and Order of Evaluation – 3”.

Pre-requisite for this C MCQ set: Advanced C Programming Video Tutorial.

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

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         int a = 5 * 3 + 2 - 4;
  5.         printf("%d", a);
  6.     }

a) 13
b) 14
c) 12
d) 1 6
View Answer

Answer: a
Explanation: None.
advertisement
advertisement

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

Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!
  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         int a = 2 + 4 + 3 * 5 / 3 - 5;
  5.         printf("%d", a);
  6.     }

a) 7
b) 6
c) 10
d) 9
View Answer

Answer: b
Explanation: None.
advertisement

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

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         int a = 5 * 3 % 6 - 8 + 3;
  5.         printf("%d", a);
  6.     }

a) 10
b) 2
c) -2
d) -3
View Answer

Answer: c
Explanation: None.
advertisement

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

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         int b = 6;
  5.         int c = 7;
  6.         int a = ++b + c--;
  7.         printf("%d", a);
  8.     }

a) Run time error
b) 15
c) 13
d) 14
View Answer

Answer: d
Explanation: None.

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

  1.     #include <stdio.h>
  2.     void main(
  3.     {
  4.         double b = 8;
  5.         b++;
  6.         printf("%lf", b);
  7.     }

a) 9.000000
b) 9
c) 9.0
d) Run time error
View Answer

Answer: a
Explanation: None.

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

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         double b = 3 % 0 * 1 - 4 / 2;
  5.         printf("%lf", b);
  6.     }

a) -2
b) Floating point Exception
c) 1
d) 0
View Answer

Answer: b
Explanation: None.

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

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         double b = 5 % 3 & 4 + 5 * 6;
  5.         printf("%lf", b);
  6.     }

a) 2
b) 30
c) 2.000000
d) Run time error
View Answer

Answer: c
Explanation: None.

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

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         double b = 3 && 5 & 4 % 3;
  5.         printf("%lf", b);
  6.     }

a) 3.000000
b) 4.000000
c) 5.000000
d) 1.000000
View Answer

Answer: d
Explanation: None.

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

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         double b = 5 & 3 && 4 || 5 | 6;
  5.         printf("%lf", b);
  6.     }

a) 1.000000
b) 0.000000
c) 7.000000
d) 2.000000
View Answer

Answer: a
Explanation: None.

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

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         int k = 0;
  5.         double b = k++ + ++k + k--;
  6.         printf("%d", k);
  7.     }

a) 6
b) 1
c) 5
d) undefined
View Answer

Answer: b
Explanation: None.

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.