Question 71
HardWhat is the output of this program?
#include <stdio.h>
int {
arr[] = {, };
s = ;
( i = ; i < ; i++) s += arr[i];
(, s, (arr) / (arr[]));
;
}
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 {
arr[] = {, };
s = ;
( i = ; i < ; i++) s += arr[i];
(, s, (arr) / (arr[]));
;
}
3 2
3 5
15 5
Garbage 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() {
char str[] = "Programming";
char *p = str + 3;
p[4] = '\0';
printf("%s %s", p, str);
return 0;
}
gram Progr
gramming Program
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() {
struct S { int a; char b[4]; } s = {7, "abc"};
struct S t = s;
t.b[0] = 'z';
printf("%s %s %d", s.b, t.b, t.a);
return 0;
}
abc zbc 0
abc zbc 7
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 = 7, b = 3;
printf("%d %d %d %d", a / b, -a / b, a % -b, -a % b);
return 0;
}
3 -2 1 -1
2 -2 1 -1
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
#include <stdio.h>
int tick(void) { static int t = 0; return ++t; }
int main() {
int a = tick();
int b = tick();
int c = tick();
printf("%d %d %d", a, b, c);
return 0;
}
0 1 2
1 2 3
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 *days[] = {"Mon", "Tue", "Wed"};
printf("%c%c %s", *days[1], *(days[2] + 1), days[0] + 1);
return 0;
}
Te Mon
Te on
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;
int *p = &x, **pp = &p;
**pp += 10;
*p *= 2;
printf("%d", x);
return 0;
}
25
30
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 = 0.1f;
double d = 0.1;
printf("%d %d", f == 0.1f, f == d);
return 0;
}
1 1
0 1
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 = 10;
int b = (a > 5) ? (a < 15 ? a * 2 : a) : 0;
int c = a > 5 ? 1 : a > 2 ? 2 : 3;
printf("%d %d", b, c);
return 0;
}
20 1
10 1
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() {
unsigned int u = 1;
int i = -1;
printf("%d", i < u);
return 0;
}
0
Compilation error
Sign up free to see the answer and a step-by-step explanation.
gram Program
gram Programming
zbc zbc 7
abc abc 7
2 -3 1 2
2 -2 -1 1
3 3 3
1 1 1
Me on
TW Mon
20
15
0 0
1 0
20 2
0 3
-1
1