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

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

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 b = 5 - 4 + 2 * 5;
  5.         printf("%d", b);
  6.     }

a) 25
b) -5
c) 11
d) 16
View Answer

Answer: c
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 b = 5 & 4 & 6;
  5.         printf("%d", b);
  6.     }

a) 5
b) 6
c) 3
d) 4
View Answer

Answer: d
Explanation: None.
advertisement

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

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

a) 6
b) 4
c) 1
d) 0
View Answer

Answer: a
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 = 5 + 7 * 4 - 9 * (3, 2);
  5.         printf("%d", b);
  6.     }

a) 6
b) 15
c) 13
d) 21
View Answer

Answer: b
Explanation: None.

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

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

a) 10 10
b) 10 9
c) 9 10
d) 8 10
View Answer

Answer: c
Explanation: None.

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

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

a) 9
b) 10
c) 12
d) 11
View Answer

Answer: d
Explanation: None.

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

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         int h = 8;
  5.         int b = 4 * 6 + 3 * 4 < 3 ? 4 : 3;
  6.         printf("%d\n", b);
  7.     }

a) 3
b) 33
c) 34
d) Run time error
View Answer

Answer: a
Explanation: None.

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

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

a) 0
b) 8
c) 11
d) 9
View Answer

Answer: b
Explanation: None.

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

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         char a = '0';
  5.         char b = 'm';
  6.         int c = a && b || '1';
  7.         printf("%d\n", c);
  8.     }

a) 0
b) a
c) 1
d) m
View Answer

Answer: c
Explanation: None.

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

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

a) 65
b) 58
c) 64
d) 59
View Answer

Answer: d
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.