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?
#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
Explanation: None.
2. What will be the output of the following 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
Explanation: None.
3. What will be the output of the following 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
Explanation: None.
4. What will be the output of the following 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
Explanation: None.
5. What will be the output of the following 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
Explanation: None.
6. What will be the output of the following 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) 0
View Answer
Explanation: None.
7. What will be the output of the following 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
Explanation: None.
8. What will be the output of the following 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
Explanation: None.
9. What will be the output of the following 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
Explanation: None.
10. What will be the output of the following 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
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.
- Watch Advanced C Programming Videos
- Practice Computer Science MCQs
- Apply for C Internship
- Check C Books
- Check Computer Science Books