MCQ Computer Science

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

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

This section on online C test focuses 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 is the output of this C code?

#include <stdio.h>
void main()
{
int a = 5 * 3 + 2 – 4;
printf(“%d”, a);
}
a) 13
b) 14
c) 12
d) 1 6

View Answer

Answer:a
2. What is the output of this C code?

#include <stdio.h>
void main()
{
int a = 2 + 4 + 3 * 5 / 3 – 5;
printf(“%d”, a);
}
a) 7
b) 6
c) 10
d) 9

View Answer

Answer:b
3. What is the output of this C code?

#include <stdio.h>
void main()
{
int a = 5 * 3 % 6 – 8 + 3;
printf(“%d”, a);
}
a) 10
b) 2
c) -2
d) -3

View Answer

Answer:c
4. What is the output of this C code?

#include <stdio.h>
void main()
{
int b = 6;
int c = 7;
int a = ++b + c–;
printf(“%d”, a);
}
a) Run time error
b) 15
c) 13
d) 14

View Answer

Answer:d

5. What is the output of this C code?

#include <stdio.h>
void main(
{
double b = 8;
b++;
printf(“%lf”, b);
}
a) 9.000000
b) 9
c) 9.0
d) Run time error

View Answer

Answer:a

6. What is the output of this C code?

#include <stdio.h>
void main()
{
double b = 3 % 0 * 1 – 4 / 2;
printf(“%lf”, b);
}
a) -2
b) Floating point Exception
c) 1
d) None of the mentioned

View Answer

Answer:b

7. What is the output of this C code?

#include <stdio.h>
void main()
{
double b = 5 % 3 & 4 + 5 * 6;
printf(“%lf”, b);
}
a) 2
b) 30
c) 2.000000
d) Run time error

View Answer

Answer:c

8. What is the output of this C code?

#include <stdio.h>
void main()
{
double b = 3 && 5 & 4 % 3;
printf(“%lf”, b);
}
a) 3.000000
b) 4.000000
c) 5.000000
d) 1.000000

View Answer

Answer:d

9. What is the output of this C code?

#include <stdio.h>
void main()
{
double b = 5 & 3 && 4 || 5 | 6;
printf(“%lf”, b);
}
a) 1.000000
b) 0.000000
c) 7.000000
d) 2.000000

View Answer

Answer:a

10. What is the output of this C code?

#include <stdio.h>
void main()
{
int k = 0;
double b = k++ + ++k + k–;
printf(“%d”, k);
}
a) 6
b) 1
c) 5
d) undefined

View Answer

Answer:d

For more Visit the Link:

Computer Science MCQ All Topic C programming MCQ All Topic

 

Related Articles

Leave a Reply

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

Back to top button