Font size
WorksheetsC_i_Quiz
Total questions: 12
Worksheet time: 5mins
What is the output of this code?
#include <stdio.h>
int main() {
int x = 5;
printf("%d", x++);
return 0;
}
4
6
5
Error
What is the output of the following program?
#include <stdio.h>
int main() {
char c = 'A';
printf("%c", c+1);
return 0;
}
A
B
66
Compile Error
C program execution begins from (a) function.
Output of this snippet?
#include <stdio.h>
int main() {
int x = 1;
printf("%d %d %d", x, ++x, x++);
return 0;
}
3 3 1
1 3 3
1 2 3
Undefined Behavior
Output for this program?
#include <stdio.h>
int main() {
char c = 'a';
printf("%d", c);
return 0;
}
97
98
65
0
What is the output here?
#include <stdio.h>
int main() {
int a = 5;
int b = a++;
printf("%d %d", a, b);
return 0;
}
5 5
5 6
6 5
Error
Output of the code?
#include <stdio.h>
int main() {
int a = 17, b = 5;
printf("%d", a % b);
return 0;
}
2
3
17
5
#include <stdio.h>
int main() {
double d = 10.123456;
printf("%.3lf", d);
return 0;
}
10.123456
10.12463
10.124
10.123
#include <stdio.h>
int main() {
char ch = 'Z';
printf("%c", ch - 1);
return 0;
}
Y
Z
X
Error
What will be the output of the following code?
#include <stdio.h>
int main() {
int num = 10;
printf("%d", ++num);
return 0;
}
Error
10
9
11
What is the output of this program?
#include <stdio.h>
int main() {
float f = 5.5;
printf("%.1f", f * 2);
return 0;
}
10.0
11.0
5.5
10.5
What will be the output of the following code?
#include <stdio.h>
int main() {
int x = 3, y = 4;
printf("%d", x * y + x);
return 0;
}
12
10
15
7
