1
GATE CSE 2018
+1
-0.3
Consider the following C program.
#include< stdio.h >
struct Ournode{
char x,y,z;
};
int main(){
struct Ournode p = {'1', '0', 'a'+2};
struct Ournode *q = &p;
printf ("%c, %c", *((char*)q+1), *((char*)q+2));
return 0;
}
The output of this program is:
A
0, c
B
0, a+2
C
'0', 'a+2'
D
'0', 'c'
2
GATE CSE 2016 Set 1
+1
-0.3
Consider the following C program
void f(int, short);
void main()
{
int i = 100;
short s = 12;
short *p = &s;
__________ ;    // call to f()
}
Which one of the following expressions, when placed in the blank above, will NOT result in a type checking error?
A
f(s,*s)
B
i = f(i,s)
C
f(i,*s)
D
f(i,*p)
3
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 _____________.
4
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);
}