250+ TOP MCQs on Precedence and Order of Evaluation and Answers

online C test on “Precedence and Order of Evaluation”. One shall practice these test questions to improve their C programming skills needed for various interviews (campus interviews, walkin interviews, company interviews), placements, entrance exams and other competitive exams. These questions can be attempted by anyone focusing on learning C Programming language. They can be a beginner, fresher, engineering graduate or an experienced IT professional. Our online C test questions come with detailed explanation of the answers which helps in better understanding of C concepts.

Here is a listing of online C test questions on “Precedence and Order of Evaluation” along with answers, explanations and/or solutions:

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

  1.     #include 
  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
Answer: a
Clarification: None.

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

  1.     #include 
  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
Answer: b
Clarification: None.

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

  1.     #include 
  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
Answer: c
Clarification: None.

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

  1.     #include 
  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
Answer: d
Clarification: None.

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

  1.     #include 
  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
Answer: a
Clarification: None.

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

  1.     #include 
  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
Answer: b
Clarification: None.

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

  1.     #include 
  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
Answer: c
Clarification: None.

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

  1.     #include 
  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
Answer: d
Clarification: None.

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

  1.     #include 
  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
Answer: a
Clarification: None.

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

  1.     #include 
  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
Answer: d
Clarification: None.

Leave a Reply

Your email address will not be published. Required fields are marked *