Q1. Find the output of the code ?
C
#include <stdio.h>
int main() {
int x = 5;
int y = x + 2;
printf("%d\n", y);
return 0;
}
a) 5
b) 2
c) 7
d) Compilation error
Q2. Find the output of the code ?
C
#include <stdio.h>
int main() {
int x = 10;
int y = x--;
printf("%d\n", y);
printf("%d\n", x);
return 0;
}
a) 9, 10
b) 10, 9
c) 10, 10
d) 11, 10
Q3. Find the output ?
C
#include <stdio.h>
int main() {
int x = 5;
int y = 2;
x = y;
printf("%d\n", x);
return 0;
}
a) 2
b) 5
c) 7
d) Compilation error
Q4. Find the output ?
C
#include <stdio.h>
int main() {
int x = 5;
int y = 3;
x = x + y;
y = x - y;
x = x - y;
printf("%d %d\n", x, y);
return 0;
}
a) 5 3
b) 3 5
c) 8 5
d) 5 8
Q5. Find the output ?
C
#include <stdio.h>
int main() {
int a = 7;
int b = 2;
int c = a % b;
printf("%d\n", c);
return 0;
}
a) 3
b) 1
c) 2
d) 0
Q6 Find the output ?
C
#include <stdio.h>
int main() {
int x = 5;
int y = ++x * 2;
printf("%d\n", y++);
return 0;
}
a) 11
b) 10
c) 12
d) 13
Q7 Find the output ?
C
#include <stdio.h>
int main() {
int a = 10;
int b = 5;
int c = a / b;
printf("%d\n", c);
return 0;
}
a) 2
b) 5
c) 10
d) 0
Q8. Find the output ?
C
#include <stdio.h>
int main() {
int a = 2;
int b = 3;
int c = a++ * b++;
printf("%d\n", c);
return 0;
}
a) 6
b) 8
c) 9
d) 10
Q9 Find the output ?
C
#include <stdio.h>
int main() {
int x = 7;
int y = 2;
int z = x / y + x % y;
printf("%d\n", z);
return 0;
}
a) 3
b) 4
c) 5
d) 7
Q10 Find the output ?
C
#include <stdio.h>
int main() {
int x = 10;
int y = x-- + --x;
printf("%d\n", y--);
return 0;
}
a) 17
b) 19
c) 18
d) 20