1
GATE CSE 2016 Set 1
Numerical
+1
-0
Consider the following C program.
#include < stdio.h >
void mystery(int *ptra, int *ptrb) {
int *temp;
temp = ptrb;
ptrb = ptra;
ptra = temp;
}
int main() {
int a=2016, b=0, c=4, d=42;
mystery(&a, &b);
if (a < c)
mystery(&c, &a);
mystery(&a, &d);
printf("%d\n", a);
}
The output of the program is _____________.
2
GATE CSE 2015 Set 1
Numerical
+1
-0
The output of the following C program is__________.

void f1(int a, int b) {
int c;
c=a; a=b; b=c;
}

void f2(int *a, int *b) {
int c;
c=*a; *a=*b; *b=c;
}

int main(){
int a=4, b=5, c=6;
f1(a,b);
f2(&b, &c);
printf(“%d”,c-a-b);
}
3
GATE CSE 2011
+1
-0.3
What does the following fragment of C-program print?
char c[ ] = "GATE2011";
char *p = c;
printf("%s", p + p[3] - p[1]);
A
GATE2011
B
E2011
C
2011
D
01
4
GATE CSE 2010
+1
-0.3
What does the following program print?
#include < stdio.h >
void f (int *p, int *q) {
p = q;
*p = 2;
}
int i = 0, j = 1;
int main ( ){
f(&i, &j);
printf ("%d %d \ n", i, j);
return 0;
}
A
2 2
B
2 1
C
0 1
D
0 2
GATE CSE Subjects
EXAM MAP
Medical
NEET