You are on page 1of 6

[Q001] What will be the output of the following program :

int func(int *ptr,int a,int b)


{
return (a+b);
*ptr=25;
}
int main()
{
int var=7,sum;
sum=func(&var,5,6);
printf("%d %d",sum,var);
return(0);
}
(a)Compile-Time Error
(b)11 25
(c)11 7
(d)None of these

[Q002] What will be the output of the following program :


int func(int *ptr,int a,int b)
{
return (a+b);
*ptr=25;
return *ptr;
}
int main()
{
int var=7,sum;
sum=func(&var,5,6);
printf("%d %d",sum,var);
return(0);
}
(a)Compile-Time Error
(b)11 25
(c)11 7
(d)None of these

[Q003] What will be the output of the following program :


int func(int *ptr,int a,int b)
{
*ptr=25;
return *ptr;
return (a+b);
}
int main()
{
int var=7,sum;
sum=func(&var,5,6);
printf("%d %d",sum,var);
return(0);
}
(a)Compile-Time Error
(b)11 25
(c)11 7
(d)25 25

[Q004] What will be the output of the following program :


#define ToStr(s) #s
#define Swap(x,y) y##x
int Swap(in,ma)()
{
if (printf(ToStr("Friends"))){}
return(0);
}
(a)Compile-Time error
(b)"Friends"
(c)Friends
(d)None of these

[Q005] What will be the output of the following program :


int main()
{
int a=(5,a=50)/a++;
printf("%d",a);
return(0);
}
(a)51
(b)0
(c)6
(d)1

[Q006] What will be the output of the following program :


int main()
{
int a=(5,a=50)/++a;
printf("%d",a);
return(0);
}
(a)51
(b)0
(c)6
(d)1

[Q007] What will be the output of the following program :


int main()
{
int a=7;
if ((++a < 7) && (++a < 9) && (++a < 25)
;
printf("%d",a);
return(0);
}
(a)7
(b)8
(c)9
(d)10

[Q008] What will be the output of the following program :


int main()
{
int a=7;
if ((++a < 7) && (a++ < 9) && (++a < 25);
printf("%d",a);
return(0);
}
(a)7
(b)8
(c)9
(d)10

[Q009] What will be the output of the following program :


int main()
{
for ( ; ; )
main();
return(0);
}
(a)Compile-Time error
(b)Run-Time Error
(c)Infinite Loop
(d)None of these

[Q010] What will be the output of the following program :


int main()
{
int a=0,b=1,c;
c = a=0 ? (a=1) : (b=2);
printf("%d %d %d",a,b,c);
return(0);
}
(a)Compile-Time Error
(b)2 2 2
(c)1 1 1
(d)None of these

[Q011] What will be the output of the following program :


int main()
{
int a=5,b=1,c;
c = a ? a=1 : b=2;
printf("%d %d %d",a,b,c);
return(0);
}
(a)Compile-Time Error
(b)2 2 2
(c)1 1 1
(d)None of these

[Q012] What will be the output of the following program :


int main()
{
unsigned _=5;
_=_--- ++_;
printf("%d",_);
return(0);
}
(a)Compile-Time Error
(b)5
(c)65535
(d)-1

[Q013] What will be the output of the following program :


int main()
{
unsigned _=5;
_=_--- ++_;
printf("%u",_);
return(0);
}
(a)Compile-Time Error
(b)5
(c)65535
(d)-1

[Q014] What will be the output of the following program :


int fun(int a,int b)
{
#define NUM 5
return a+b;
return(0);
}
int main()
{
printf("Sum=%d",fun(NUM,NUM));
return(0);
}
(a)Compile-Time Error
(b)Run-Time Error
(c)Sum=10
(d)None of these

[Q015] What will be the output of the following program :


int main()
{
int a=5,b=6,c=7;
printf("%d %d",a,b,c);
return(0);
}
(a)Compile-Time Error
(b)5 6
(c)Run-Time Error
(d)5 6 7

[Q016] What will be the output of the following program :


int add(int a,int b)
{
return a+b;
}
int main()
{
int a=1,b=2;
printf("%d",add(add(add(a,b),add(a,b)),add(add(a,b),add(a,b))));
return(0);
}
(a)Garbage Value
(b)Compile-Time Error
(c)Run-Time Error
(d)12

[Q017] What will be the output of the following program :


#define S(s)char x[]="Welcome to ";s
#define P(s) #s
#define Q(x)char x[]=#x
#define A(x,y)y##x
#define B(x,y)A(y,x)
#define C(x,y)B(y,x)
S(B(A(a,m),A(n,i))(){Q(C(B(A(n,e),d),B(A(r,f),i))s);B(A(t,
s),B(A(c,r),A(y,p)))(C(B(A(n,e),d),B(A(r,f),i))s,P(c4swimmers)
);B(A(r,p),B(A(n,i),A(f,t)))("%s%s",x,C(B(A(n,e),d),B(A(r,f),i))s)
;B(A(e,r),B(A(u,t),A(n,r))) 0;})
(a)Compile-Time Error
(b)Welcome to c4swimmers
(c)Welcome to
(d)c4swimmers

[Q018] What will be the output of the following program :


int main()
{
int a=5,b=6,c=7,d=8,e;
e = a ? b , c : c , d;
printf("%d",e);
return(0);
}
(a)Compile-Time Error
(b)6
(c)7
(d)8

[Q019] What will be the output of the following program :


int main()
{
int a=5,b=6,c;
c++ = b % (b - a);
printf("%d",c);
return(0);
}
(a)Compile-Time Error
(b)6
(c)7
(d)None of these

[Q020] What will be the output of the following program :


int main()
{
int x=5,y=6,z;
z = x++ +++y;
printf("%d %d %d",x,y,z);
return(0);
}
(a)Compile-Time Error
(b)3
(c)-1
(d)0

You might also like