Question 11
EasyWhat is the output of this program?
#include <stdio.h>
int main() {
int x = 5;
printf("%d", x++ + 1);
return 0;
}
- A.
5
- B.
7
- C.
6
- D.
11
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Programming Languages
What is the output of this program?
#include <stdio.h>
int main() {
int x = 5;
printf("%d", x++ + 1);
return 0;
}
5
7
6
11
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
#include <stdio.h>
int main() {
int x = 5;
printf("%d", ++x * 2);
return 0;
}
11
12
6
10
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
#include <stdio.h>
int main() {
char c = 'A' + 2;
printf("%c", c);
return 0;
}
B
C
A2
67
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
#include <stdio.h>
int main() {
int a[] = {1, 2, 3, 4};
printf("%d", a[1] + a[3]);
return 0;
}
5
7
6
4
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
#include <stdio.h>
int main() {
for (int i = 0; i < 3; i++)
printf("%d", i);
return 0;
}
123
012
0123
12
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
#include <stdio.h>
int main() {
int i = 0;
while (i < 5)
i += 2;
printf("%d", i);
return 0;
}
8
4
6
5
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
#include <stdio.h>
int main() {
printf("%d", 7 / 2 * 2);
return 0;
}
7
1
14
6
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
#include <stdio.h>
int main() {
float f = 7 / 2;
printf("%.1f", f);
return 0;
}
4.0
3
3.0
3.5
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
#include <stdio.h>
int main() {
int x = 3;
if (x = 0)
printf("A");
else
printf("B");
return 0;
}
Compilation error
A
B
AB
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
#include <stdio.h>
int main() {
int a = 9;
int *p = &a;
*p = 4;
printf("%d", a);
return 0;
}
9
An address
13
4
Sign up free to see the answer and a step-by-step explanation.