You are on page 1of 117

101. What is the output of the program?

#include<stdlib.h>

int main()
{
int *arr;
arr=malloc(10*sizeof(int));
clrscr();
printf("size = %d",sizeof(arr));
return 0;
}

(a). size = 2
(b). size = 4
(c). size = 20
(d). size = 1

102. What is the output of the program?

void main()
{
int rain[20]={2,3,4,5,};
int *arr;
clrscr();
arr = rain[-1];
printf("%d,",arr);
printf("%d",rain[-1]);
}

(a). garbage value, same garbage value


(b). different junk values
(c). compilaton error
(d). runtime error
(e). 2,2

103. What is the output of the following program?

int main()
{
char *s1="tech";
char *s2="campus";
char *s3=strcat(s1,s2);
clrscr();
printf("%s",s3);
printf(",%c",s3);
return 0;
}

(a). techcampus,t
(b). techcampus,techcampus
(c). techcampus,garbage value
(d). error
104. What is the output of the following program?

int main()
{
struct y{
int i=10
char c='A';
}a,b;
a.i=i+2;
b.c=c+3;
printf("%d,%c",a.i,b.c);
return 0;
}

(a). 12,C
(b). 12,D
(c). 12,68
(d). error

105. What is the output of the program?

int main()
{
char *result = "do it";
strcat(result,'!');
printf("%s",result);
return 0;
}

(a). do it!
(b). do itgarbage value
(c). garbage value
(d). program terminates

106. What is the output of the program?

int main()
{
char *a[14];
a="hello baby";
clrscr();
printf("%s",a);
return 0;
}

(a). hello baby


(b). h garbage value
(c). error: Lvalue required
(d). junk values

107. What is the output of program?

108. What is the output of the following program?


109. What is the output of the program?

int main()
{
const char *c1;
char const *c2;
char *const c3;
c1="a";
c2="b";
c3="c";
clrscr();
printf("%c,%c,%c",c1,c2,c3);
return 0;
}

(a). empty screen


(b). error
(c). a,b,c
(d). a,b,junk value

110. Give the output of the program?

111. What is the o/p in large memory model, small memory


model, medium memory model, huge memory model, tiny and
compact memory models?

int main( )
{
int *p,a;
char *q,b;
clrscr();
printf("%d,%d,",sizeof(p),sizeof(q));
printf("%d,%d",sizeof(a),sizeof(b));
return 0;
}

(choices) Large <=> Small <=> Medium <=> Huge <=> Tiny <=>
Compact

(a). 4,4,2,1 <=> 2,2,2,1 <=> 2,2,2,1 <=> 4,4,2,1 <=>


2,2,2,1 <=> 4,4,2,1
(b). 4,4,4,2 <=> 2,2,2,1 <=> 4,4,2,1 <=> 4,4,4,2 <=>
1,1,1,1 <=> 2,2,2,1
(c). 4,4,2,1 <=> 1,1,1,1 <=> 4,4,2,1 <=> 4,4,2,1 <=>
2,2,2,1 <=> 4,4,2,1
(d). 4,4,2,1 <=> 2,2,2,1 <=> 2,2,2,1 <=> 4,4,2,1 <=>
1,1,1,1 <=> 2,2,2,1

112. What is the output of the program?

int main()
{
int *t;
t=malloc(0);
printf("t=%d",t);
return 0;
}

(a). t=0
(b). t=junk value
(c). error
(d). empty screen

113. What is the output of the program?

# include<stdio.h>

int main()
{
char c;
clrscr();
while((c=getch( )) !=EOF)
printf("hai");
return 0;
}

(a). hai
(b). hai for infinite times
(c). hai till EOF is reached
(d). error

114. What is the output of the program?

main( )
{
int a=0;
switch(a)
{
case -0:
{
a++;
if(a!=0)
{
a++;
case 1:a++;
case 2:a--;
}

case 3: a--;
}
clrscr();
printf("%d",a);
return 0;
}
(a). 1
(b). 2
(c). 3
(d). 4
(e). 0

115. What is the output of the program?

int a[10];

main( )
{
int a,b,c;
a=10;b=1;
c=a-;
clrscr();
printf("%d",c);
return 0;
}

(a). 10
(b). 11
(c). 12
(d). 9

116. What is the output of the program?

int main()
{
float x,y;
x=1.00000001;
y=1;
clrscr();
if(x == y)
printf("good work");
else
printf("bad work");
return 0;
}

(a). good work


(b). bad work
(c). error

117. What is the output of the program?

int main()
{
char *s="baby's day out";
s[0]="h";
printf("%s",s);
}
(a). baby's day out
(b). haby's day out
(c). error
(d). garbage value

118. What is the output of the program?

119. What is the output of the program?

register int a=10;

main( )
{
auto int b=9;
a=a-b;
b=a+b;
clrscr();
printf("%d,%d",a,b);
return 0;
}

(a). 1,19
(b). 0,-10
(c). 0,9
(d). error

120. What is the output of the program?

int main()
{
int result;
struct x
{
int rad;
int dia;
int calculate(int,int);
}s1;
s1.rad=10;s1.dia=2.9;
result=s1.calculate(s1.rad,s1.dia);
printf("%d",result);
return 0;
}

int calculate(int n1,int n2)


{
int temp;
temp=s1.rad+s1.dia;
return temp;
}

(a). 12.9
(b). 12.900000
(c). 12
(d). error
121. What is the output of the program?

void main( )
{
int i=10;i++;
clrscr();
if(i=i+1||2)
printf("%d",i);
return 0;
}

(a). 12
(b). 13
(c). 1
(d). 0
(e). error

122. What is the output of the program?

int main( )
{
struct s{
int i;
char c;
}a,*b;
b=&a;
b->i=99;
b->c='A';
sum(b);
return 0;
}

int sum(int *x)


{
clrscr();
x=x+2;
printf("%d",*x);
}

(a). 65
(b). 68
(c). 0
(d). error in passing arguements

123. What is the output of the program?

#include<dos.h>

int main()
{ clrscr();
getinterrupt(0x18);
return 0;
}
(a). the capslock key is switched on
(b). waits for user input
(c). system reboots after pressing a key
(d). the program terminates

124. What is the output of the program?

int main()
{
int x,y,z;
clrscr();
//input 2,3
z=scanf("%d,%d",&x,&y);
printf("%d,%d,%d",x,y,z);
return 0;
}

(a). 2,3,2
(b). 2,3,3
(c). 2,3,1
(d). error
(e). none of the above

125. What is the output of the program?

int main()
{
int box, pack;
box=(6,7);
pack=6,7;
clrscr();
printf("%d,%d",box,pack);
return 0;
}

(a). 6,7
(b). 6,6
(c). 7,6
(d). 7,7

126. What is the output of the program?

127. What is the output of the program?

int main()
{
int x,y,n=-2;
clrscr();
//input 2,3
printf("%d,",scanf("%d,%d",&x,&y));
printf("%d,%d,",x,y);
printf("haiguys,");
printf("n=%*d",n,n);
return 0;
}

(a). 2,2,3,haiguys,n=-2
(b). 1,2,3,haiguys,n=2
(c). 2,2,3,haiguys,n=2
(d). garbage value

128. What is the output of the program?

129. What is the output of the program?

int main()
{
int x;
for(;;)
{
x++;
if(x==10)
break;
}
clrscr();
printf("%d",x);
return 0;
}

(a). infinite loop


(b). error
(c). garbage value
(d). 10

130. What is the output of the program?

int main()
{
char buf[10]="hai sweeties";
clrscr();
printf("%c,%c,%c",10[buf],*(buf+10),*(10+buf));
return 0;
}

(a). e,e,e
(b). garbage value
(c). error
(d). i,i,i

131. What is the output of the program?

int main()
{
static int x[]={0,1,2,3,4};
static int *y[]={x,x+1,x+2,x+3,x+4};
int **ptr= *y;
clrscr();
printf("%d,%d,%d",*x,*(y+1),**ptr);
return 0;
}

(a). 0,1,0
(b). 0,0,0
(c). 0,garbage value,0
(d). error

132. What is the output of the program?

int main()
{
int i= - - 5,j={1234},z;
clrscr();
printf("%d,%d,",i,j);
z=0x10+010+10;
printf("%d",z);
return 0;
}

(a). 5,1234,34
(b). 5,1234,30
(c). 5,1234,32
(d). 5,1234,31

133. What is the output of the program?

#define add(a,b) (a##b)

int main()
{
clrscr();
printf("%d",add(50,99));
return 0;
}

(a). 50,99
(b). 5099
(c). 9955
(d). error

134. What is the output of the program?

int main()
{
int x,y;
x=0;
clrscr();
y=~x;
printf("%x,%x",x,y);
return 0;
}
(a). 0,1
(b). 0,0
(c). 0,ffff
(d). garbage values

135. What is the output of the program?

int main()
{
char box[5];
clrscr();
//input 2,3
box[0]=getchar( );
box[1]=getchar( );
printf("%c,%c",box[0],box[1]);
return 0;
}

(a). Incorrect array usage


(b). garbage values
(c). 2,3
(d). 2,

136. What is the output of the program?

#define x 0
#define y '0'
#define z "0"

int main()
{
clrscr();
printf("%d,%d,%d", sizeof(x), sizeof(y),sizeof(z));
return 0;
}

(a). 0,0,0
(b). 2,2,2
(c). 0,1,garbage value
(d). junk values
(e). error

137. What is the output of the program?

int main()
{
char *s;
clrscr();
//Input => fireabc
scanf("%[abcd]s",s);
printf("%s",s);
return 0;
}
(a). fire
(b). fire abc
(c). empty screen
(d). error in scanf statement

138. What is the output of the program?

int main()
{
int x=10,y=20,z=30,a=40;
int b=50;
clrscr();
printf("%d,%d,%d,%d,%d",x,b);
return 0;
}

(a). 10,50,50,40,30
(b). 10,50,30,40,50
(c). 10,50,10,20,30
(d). 10,50,40,30,20

139. What is the output of the program?

int main()
{
int x=5,y;
y=sizeof(int)*5;
clrscr();
printf("%d,%d",x,y);
return 0;
}

(a). 5,10
(b). 5,5
(c). 5,2
(d). 5,1

140. What is the output of the program?

int main()
{
int add(void);
int y;
y=add( );
clrscr();
_AX=100;
printf("%d,%d,",y,_AX);
_AX=200;
printf("%d",_AX);
return 0;
}

int add(void)
{
printf("1234");
_AX=123;
}

(a). 1234,100,200
(b). 1234,garbage values
(c). 123,100,200
(d). 1234,100,200
(e). 123,123,200

141. What is the output of the program?

int main()
{
int a,b;
clrscr();
//input => 2,3
scanf("a:%d b:%d",&a,&b);
printf("%d,%d,",a,b);
// input => 2,3
scanf("a:%d b:%d",&a,&b);
printf("%d,%d",a,b);
return 0;
}

(a). 2,3,2,3
(b). 3,2,3,2
(c). 2,3,3,2
(d). garbage value
(e). error

142. What is the output of the program?

# include<stdio.h>
# include<conio.h>

int main( )
{
struct bee{
int a;
char c;
}y,z;
clrscr();
y.a=10;
y.c='A';
z=y;
printf("%d,%c",z.a,z.c);
return 0;
}

(a). 10,A
(b). 10,a
(c). 10,garbage value
(d). error
143. What is the output of the program?

144. What is the output of the program?

145. What is the output of the program?

int main()
{
float x=0.5,y=0.7;
if(y<.7)
{
if(x<.5)
printf("hello");
else
printf("ask me");
}
else
printf("Hai");
return 0;
}

(a). hello
(b). ask me
(c). Hai
(d). error

146. What is the output of the program?

int main()
{
char a[]="VC++";
char *b="VC++";
clrscr();
printf("%d,%d",sizeof(*a),sizeof(*b));
return 0;
}

(a). 1,1
(b). 2,2
(c). 4,4
(d). 2,4

147. What is the output of the program?

int main()
{
char box[2][40]={"ijklmnoprstuvwxyz"};
clrscr();
printf("%c",*(*(box+1)+3));
return 0;
}
(a). k
(b). l
(c). n
(d). o
(e). empty screen
(f). error

148. What is the output of the program?

int main()
{
struct {
int a;
char b;
};
struct a=2;
clrscr();
printf ("%d",a);
return 0;
}

(a). error in structure definition


(b). error in structure member initialization
(c). garbage value
(d). 2

149. What is the output of the program?

150. What is the output of the program?

# include<stdio.h>

void main()
int i;
{
clrscr();
printf("%d,%d",1,i);
getch();
}

(a). error
(b). 1,0
(c). 1,garbage
(d). junk values

151. What is the output of the program?

# include<stdio.h>

void main()
{
static int i;
clrscr();
for(i=0;i<20;i++);
printf("Good");
printf(",%d",i);
getch();
}

(a). prints Good 20 times, 20


(b). prints Good 19 times, 20
(c). Good,20
(d). Good,19

152. What is the output of the program?

# include<stdio.h>

int a=1,b=2,c=3;
x1()
{
a=b+c;
printf("%d,",a);
}
x2()
{
b=a+c;
printf("%d,",b);
}
x3()
{
c=a+b;
printf("%d",c);
}
void main()
{
int (*fp[3])();
clrscr();
fp[0]=x1();
fp[1]=x2();
fp[2]=x3();
getch();
}

(a). error
(b). 5,8,13
(c). 5,4,3

153. Will this program compile?

# include<stdio.h>

void main()
{
int x[5];
x[-3]=120;
clrscr();
printf("%d,",x[-2]);
printf("%d",x[-3]);
getch();
}

(a). Yes
(b). No

reason : junk values will be printed


*/

154. What is the output of the program?

155. What is the output of the program?

# include<stdio.h>

void main()
{
int x,y;
x=5,y=7;
*&x=5;
(*&)y=10;
clrscr();
printf("%d,%d",x,y);
getch();
}

(a). 5,10
(b). 5,junk
(c). error
(d). junk,10

156. What is the output of the program?

# include<stdio.h>

void main()
{
int x=20;
clrscr();
x=-x/++x;
printf("%d",x);
getch();
}

(a). -1
(b). 0
(c). error
(d). empty screen

157. What is the output of the program?

# include<stdio.h>
void main()
{
struct x1{
unsigned int check : 1;
unsigned int transmit : 0;
unsigned int receive : 4;
}machine[6];
clrscr();
machine[0].check=1;
machine[1].transmit=1;
machine[5].receive=10;
printf("%d,%d,%d",machine[0].check,machine[1].transmit,
machine[5].receive);
getch();
}

(a). 1,1,10
(b). 1,1,2
(c). error
(d). 1,1,junk

158. What is the output of the program?

# include<conio.h>
# include<stdio.h>

void main()
{
register int x=y=10;
auto int a=b=10;
clrscr();
printf("%d,%d,%d,%d",x,y,a,b);
getch();
}

(a). 10,10,10,10
(b). 10,junk,10,junk
(c). error
(d). junk,10,junk,10

159. What is the output of the program?

# include<stdio.h>

void main()
{
struct status{
unsigned int trans : 2;
unsigned int receive : 2;
unsigned int : 4;
};
struct status machine;
clrscr();
machine.trans=7;
printf("%d",machine.trans);
getch();
}

(a). error
(b). junk
(c). 7
(d). 3

160. What is the output of the program?

# include<stdio.h>

void main()
{
char *s="abcd";
char *p;
p=s;
++p;
s=p;
clrscr();
printf("%c",*(s++));
getch();
}

(a). b
(b). c
(c). error
(d). junk

161. What is the output of the program?

# include<stdio.h>

void main()
{
union machine{
int i;
char c;
}m1;
clrscr();
m1.c='0';
printf("%d,%d",m1.i,(int)m1.c);
getch();
}

(a). 0,0
(b). garbage,0
(c). 0,garbage
(d). garbage,ascii value

162. What is the output of the program?

# include<conio.h>
# include<stdio.h>

void main()
{
int a,b,c,d;
clrscr();
a=0xa;
b=021;
c=100;
d=a+b+c;
printf("%d,%d,%d",a,b,d);
getch();
}

(a). 10,17,127
(b). error
(c). 10,27,137
(d). 10,25,135

163. What is the output of the program?

# include<stdio.h>

void main()
{
int x;
float y=z;
int z;
clrscr();
x=7/3;
y=7/3;
z=(float)7/3;
printf("%d,%f,%f",x,y,z);
getch();
}

(a). 2,2.000000,2.000000
(b). 2,2.333333,2.333333
(c). 2,2.000000,2.333333
(d). error

164. What is the output of the program?

# include<stdio.h>

void main()
{
clrscr();
printf("%d,",5.9);
printf("%f,",5);
printf("%d",3);
getch();
}
(a). 5,5.000000,3
(b). junk value, 0.000000,3
(c). 5,0.000000,3
(d). error

165. What is the output of the program?

# include<conio.h>
# include<stdio.h>

f1(){};
int ab;
void main()
{
ab=f1();
clrscr();
printf("%d",ab);
getch();
}

(a). 0
(b). garbage value
(c). accumulator value
(d). error

166. What is the output of the program?

#include <stdio.h>

int x2=0,x3=0,x4=0,x5=0;
void f1(int x1,int x2,...);
void main()
{
clrscr();
f1(10,20);
f1(10,20,30);
f1(10,20,30,40);
getch();
}

void f1(int x1,int x2 ,...)


{
int sum = 0;
sum = x1+x2+x3+x4+x5;
printf("%d,",sum);
}

(a). 30,30,30,
(b). 30,60,100,
(c). 30,90,190,
(d). error
167. What is the output of the program?

#include <stdio.h>

main()
{
clrscr();
printf();
printf("%d");
printf("%d",0);
getch();
}

(a) 0,0,0
(b) ,0,0
(c) error : printf() should have arguments

168. What is the output of the program?

#include <stdio.h>

char *x ="commando";
void main()
{
char *s="arm";
clrscr();
printf("%c,",*++x);
printf("%c,",++*(++s));
printf("%c,",++*(s++));
printf("%c,",(++x));
printf("%c",(x++));
getch();
}

(a). o,m,junk,junk,junk
(b). o,r,m,o,c
(c). o,s,t,junk,junk
(d). error

169. What is the output of the program?

# include<conio.h>
# include<stdio.h>

void main()
{
int a,b,c,d,e,f,g,h;
clrscr();
a=5/6;
b=5||6;
c=5&6;
d=5&&6;
e=5>6;
f=5>>6;
g=5<6;
h=5<<6;
printf("%d,%d,%d,%d,%d,%d,%d,%d",a,b,c,d,e,f,g,h);
getch();
}

(a). 0,3,4,1,0,0,1,320
(b). 0,1,1,4,1,0,1,320
(c). 0,1,4,1,0,0,1,320
(d). 0,1,4,1,1,0,1,320

170. What is the output of the program?

#include <stdio.h>

main()
{
int x,y,z;
clrscr();
x=5;y=4;
z=x>>y?50:60;
printf("%d,",z);
printf("%d",10>9?50:60);
getch();
}

(a) 50,50
(b) 60,60
(c) 60,50
(d) error

171. What is the output of the program?

#include <stdio.h>

main()
{
int x;
x=10;
clrscr();
printf("%d",f());
getch();
}

f()
{
return x;
return 8;
}

(a) error:2 return statements in function f()


(b) error:undefined symbol x
(c) 10
(d) both (a) & (b)
172. What is the output of the program?

#include <stdio.h>

main()
{
char c;
int x,y,z;
x=5;y=6;
clrscr();
printf("%d,",x^y);
printf("%d,",z^z);
printf("%c,",c^c);
printf("%d,",c^c);
getch();
}

(a) 3,0,garbage,0
(b) 3,0, ,0
(c) error

173. What is the output of the program?

#include <stdio.h>

int i=10;
main()
{
int x;
clrscr();
x=f1();
printf("%d,",x);
x=f2();
printf("%d",x);
getch();
}

static int f1()


{
return ++i;
}

static int f2()


{
return i++;
}

(a) 11,11
(b) 11,12
(c) garbage values

174. What is the output of the program?

#include <stdio.h>
main()
{
char x[3];
clrscr();
x++;

f1(x);
printf("%s",x);
getch();
}

f1(char x[])
{
x++;
}

(a) garbage values


(b) error: Lvalue required in main()
(c) error: Lvalue required in function f1()
(d) both (b) & (c)

175. What is the output of the program?

#include <stdio.h>

main()
{
int box[10];
clrscr();
9[box]=9;
printf("%d",*(box+9));
box[9]=19;
printf("%d",*(box+9));
getch();
}

(a) 9,19
(b) garbage,19
(c) 9,garbage
(d) error

176. What is the output of the program?

#include <stdio.h>

main()
{
union
{
struct
{
int x;
float a;
float y;
}s1;
double z;
}u1;
union{
union{
char r;
char q;
}u2;
union{
char x;
char y;
}u3;
}u4;
clrscr();
printf("%d,",sizeof(u1));
printf("%d",sizeof(u4));
getch();
}

(a) 16,4
(b) 10,1
(c) 8,1

177. What is the output of the program?

#include <stdio.h>

struct
{
unsigned int x;
}abc;

main()
{
clrscr();
(*abc)->x=999;
printf("%d",abc.x);
printf("%d",abc->x);
getch();
}

(a) error
(b) 999,999
(c) 999,garbage

178. What is the output of the program?

#include <stdio.h>

main()
{
struct
{
int x;
int y;
}*abi;
(*&abi)->x=123;
(&*abi)->y=456;
printf("%d,%d",abi.x,abi.y);
getch();
}

(a) Error
(b) 123,456
(c) garbage,456
(d) 123,garbage
(e) garbage,garbage

179. What is the output of the program?

#include <stdio.h>

main()
{
clrscr();
printf("hai");
(*main)();
main();
}

(a) error in line 3 & line 4


(b) error in line 3
(c) error in line 4
(d) haihaihaihaihai...
(e) unreachable code in line 4 & haihaihaihaihai...

180. What is the output of the program?

#include <stdio.h>

void main()
{
clrscr();
printf("Body","Heat");
printf("Bo""dy");
getch();
}

(a) BodyHeatBody
(b) BodyHeatBo
(c) BodyBo
(d) BodyBody

181. What is the output of the program?

#include <stdio.h>
void main()
{
long x=65537+66;
long y=65536+65;
long z=65536+66;
clrscr();
printf("%ld,%,%ld",x,y,z);
getch();
}

(a). 65603,%,%ld
(b). 65603,65601,65602
(c). 65603,junk,65602

182. What is the output of the program?

#include <stdio.h>
#define abi dass
#define dass "abi"

main()
{
clrscr();
printf("abi+dass");
printf("%s",dass);
getch();
}

(a) abi+dassabi
(b) abi+dass
(c) error in line1
(d) error in line2

183. What is the output of the program?

#include <stdio.h>

main()
{
struct handler
{
struct handler
{
int handler;
}*handler;
}handler;
struct handler handle;
clrscr();
handle.handler->handler=999;
printf("%d",handle.handler->handler);
getch();
}

(a). error
(b). 999
(c). junk value

184. What is the output of the program?

#include <stdio.h>

union outpay{
int amount;
}outpay;
struct outpay{
int amount;
}outpay;
outpay amount=100;

main()
{
union outpay{
int amount;
}outpay;
struct outpay{
int amount;
}outpay;
outpay.amount=200;

clrscr();
printf("%d",outpay.amount);
printf("%d",sizeof(outpay));
getch();
}

(a) 200,2
(b) 100,2
(c) garbage,2
(d) error

185. What is the output of the program?

#include <stdio.h>

void main()
{
clrscr();
printf("Good\nWo\rrk");
printf("Good %c work",90);
getch();
}

(a) Good
WorkGood z work
(b) Good
rkGood z work
(c) Good
rkGood 90 work
186. What is the output of the program?

#include <stdio.h>

static char hit[3];


main()
{
static char box[3];
clrscr();
f1(hit);
f1(box);
printf("%d,",hit[2]);
printf("%c,",hit[2]);
printf("%d,",box[2]);
printf("%d,",box[2]);
getch();
}
f1(char hit[])
{
hit[]=999;
}

(a) garbage,garbage,garbage,garbage
(b) 0, ,0,0
(c) garbage, ,garbage,garbage
(d) error

187. What is the output of the program?

#include <stdio.h>

void main()
{
char box[3];
clrscr();
box[1]=hit(box);
printf("%d",box[1]);
getch();
}

hit(int box[])
{
box[1]=999;
}

(a). 999
(b). garbage value
(c). error : function must return a value

188. What is the output of the program?

#include<stdio.h>

main()
{
int sum;
clrscr();
sum=49000*10-49000*10;
printf("%f",sum);
getch();
}

(a) 0.000000
(b) 0
(c) error

189. What is the output of the program?

#include <stdio.h>

main()
{
struct
{
struct
{
int i;
char j;
}st;
union
{
int i;
char j;
}un;
long x;
}str;
clrscr();
str.un.i=9;
str.un.j='a';
str.x=876.98;
printf("%d,%c,%ld",str.un.i,str.un.j,str.x);
getch();
return 0;
}

Ascii value of 'a' = 97

(a). 9,A,876.98
(b). 97,A,876
(c). 97,A,876.98
(d). 9,A,876

190. What is the output of the program?

#include <stdio.h>

void main()
{
int i,x,y,z;
clrscr();
for(i=1,y=0,y++;i>y;i++,y++)
{
y--
printf("Tech Guys");
}
getch();
}

(a) Tech Guys


(b) No Output
(c) Tech GuysTech GuysTech GuysTech GuysTech Guys...
(d) error

191. What is the output of the program?

192. What is the output of the program?

#include<stdio.h>

main()
{
char *x,**y;
char p;
p= 'a';
x=&p;
y=&x;
x=*y;
y=(*(&x));
printf("%c",*x);
}

(a). error
(b). garbage value
(c). a
(d). empty screen

193. What is the output of the program?

#include <stdio.h>

main()
{
int *x;
char *y;
float *z;
char a[20]="12345";
clrscr();
x=(int *)(a);
y=(a);
z=(float *)(a);
printf("%d,",*(x));
printf("%c,",*(y+1));
printf("%f",*(z+1));
getch();
}

(a) garbage,garbage,garbage
(b) garbage,2,garbage
(c) 0,2,garbage
(d) 0,2,0.000000
(e) garbage,2,0.000000

194. What is the output of the program?

#include<stdio.h>

void main()
{
FILE *fp;
clrscr();
fp=fopen("thiru.out","w");
printf("\n%d",flushall());
getch();
}

(a). 4
(b). 5
(c). 6
(d). 7

195. What is the output of the program?

#include<stdio.h>
#include<conio.h>

void main()
{
int *p,**q,i=10;
clrscr();
p=&i;
q=&p;
free(p);
printf("%d,%d",i,p);
getch();
}

(a). error
(b). 10,10
(c). junk values
(d). 10,2408

196. What is the output of the program?

void main()
{
char buf[50]="good luck";
char *pt=buf+5;
memmove(buf,pt,10);
printf("\n%s",buf);
}

(a). good
(b). luck
(c). good luck
(d). none

197. What is the output of the program?

main()
{
int j=300,k=1;
two(300,1);
return 0;
}
two(long l)
{
printf("%ld",l);
return 0;
}

(a). 65836
(b). 301
(c). 300
(d). 1

198. What is the output of the program?

void main()
{
float p;
float *q,**r,**s;
printf("\n%d,%d,%d,
%d",sizeof(p),sizeof(q),sizeof(r),sizeof(s));
getch();
}

(a). 4,4,4,4
(b). 4,2,2,2
(c). 4,4,2,2
(d). 2,2,2,2

199. What is the output of the program?

void main()
{
int i;
getch();
int pro;
for(i=0;i<=5;i++)
{
pro=pro*i;
}
printf("%d",pro);
return 0;
}

(a). 15
(b). 0
(c). 120
(d). error

200. What is the output of the program?

#include <stdio.h>
#include <string.h>

main()
{
char a[]="Research;and;Development;Lab";
char *ptr;
clrscr();
ptr=strtok(a,";");
printf("\n%s",ptr);
ptr=strtok(NULL,";");
ptr--;
printf(",%s",ptr);
ptr=strtok(NULL,";");
printf(",%s",ptr);
getch();
return 0;
}

(a) Research,and,Development
(b) Research
(c) Research,,Development
(d) Research;,and;,Development
(e) Research,,and
201. What is the output of the program?

int main(void)
{
char string[10];
char *str1="abcdefghi";
str1=stpcpy(string,str1);
printf("%s\n%s",string,str1);
return 0;
}

(a). abcdefghi abcdefghi


(b). abcdefghi
(c). abcdefghi
(d). abcde fghi

202. What is the output of the program?

#include<string.h>
#include<stdio.h>

int main(void)
{
char str[17];
int *ptr;
clrscr();
strcpy(str,"Innavate");
ptr=(int*)memchr(str,'t',strlen(str));
if(ptr)
printf("%d\n",ptr-str);
return 0;
}

(a). 1
(b). 2
(c). 3
(d). 4

203. What is the output of the program?

void main()
{
int x,y;
x=6,7;
y=(6,7);
printf("%d, %d",x,y);
}

(a). 6,7
(b). 7,6
(c). 6,6
(d). error
204. What is the output of the program?

#include<stdio.h>

int (*main())();
int (*main())()
{
int i=12;
fun(scanf,i++,printf);
return 0;
}

fun(int(*get)(const char*,...),int i,int (*put)(const


char*,...))
{
put("LIRD C world %d",i++);
return 0;
}

(a). LIRD C WORLD 12


(b). LIRD C WORLD 13
(c). LIRD C WORLD 14
(d). Error : undefined symbol

205. What is the output of the program?

char *XXX(char *str,char *str1)


{
return(*str1=*str)?XXX(str+1,str1+1),str1:0;
}

int XXX(char *str,char *str1)


{
return(*str!=0&&*str1!=0&&*str1==*str)?
XXX(str+1,str1+1),0L*str-*str1);
}
char *XXX(char *str, char s)
{
return *str!=0?(*str==s?str:XXX(str+1)):0;
}

(a). memset,compare,copy
(b). compare,copy,strchr
(c). copy,compare,strchr
(d). compare,memset,copy

206. What is the output of the program?

#define v(x) x*x/+10

main()
{
int i=10,j=5;
clrscr();
j=v(i)*v(j);
printf("\n%d",j);
getch();
return 0;
}

(a). 145
(b). 110
(c). 25
(d). 360
(e). 10

207. What is the output of the program?

#define FALSE 0
# define TRUE -1
# define HAI 1

void main()
{
int x=1,y=2;
if(FALSE<HAI<TRUE)
printf("%d",x+y);
else
printf("Sorry");
}

(a). 3
(b). sorry
(c). error
(d). infinite loop

208. What is the output of the program?

void main()
{
char c[10]="Dass";
clrscr();
printf("%d",printf("\n"));
printf(",%d",printf(",%s",c));
}

(a). 1,5,2,Dass
(b). 1,Dass,5
(c). error
(d). garbage value

209. What is the output of the program?

# include<stdio.h>

void main()
{
int x;
x=-5;
x=(+)x;
clrscr();
printf("%d",x);
getch();
}

(a). 5
(b). error
(c). -5

210. What is the output of the program?

# include<stdio.h>

void main()
{
int y;
y=-5;
y=+y;
clrscr();
printf("%d",y);
getch();
}

(a). 5
(b). junk
(c). -5
(d). error

211. What is the output of the program?

main()
{
char c=-64;
int i=32;
unsigned int u=-16;
clrscr();
if(c>1)
{
printf("pass1");
if(c<u)
printf("pass2");
else
printf("fail2");
if(u)
printf("fail1");
}
if(i<u)
printf("pass2");
else
printf("fail2");
return 0;
}
(a). pass1,pass2
(b). pass1,fail2
(c). fail1,pass2
(d). fail1,fail2
(e). pass2

212. What is the output of the program?

void main()
{
int l=-1;
clrscr();
+l;
printf("%d",l);
}

(a). 1
(b). +1
(c). -1
(d). error

213. Which of the following lines will cause error?

# include<conio.h><stdio.h> //line 1
# include<conio.h,stdio.h> //line 2
# include<conio.h>,<stdio.h> //line 3
# include<stdio.h>.<conio.h> //line 4

(a). 1,2,3
(b). 2
(c). 3
(d). 4

214. What is the output of the program?

int aa=55;
void main()
{
static int cc=10;
static int bb=aa;
clrscr();
printf("%d,%d",bb,cc);
}

(a). 55,10
(b). 0,10
(c). junk value
(d). error

215. What is the output of the program?

void main()
{
clrscr();
printf("\101\102\103\104\105\106\107");
getch();
}

(a). 101102103104105106107
(b). \101\102\103\104\105\106\107
(c). ABCDEFG
(d). abcdefg

216. What is the output of the program?

#include <stdio.h>
# define value 9

void main()
{
int deci,i=0,dig,n,j=0,bin[100];
deci = value;
clrscr();
i=0;
do
{
dig=deci%2;
deci=deci/2;
bin[i]=dig;
i++;
}while(deci>0);

//****---->

for(j=i-1;j>=0;j--) //st to be inserted


printf("%d",bin[j]);
getch();
}

Which st.. to be inserted at ****---> to get binary value of a


decimal number ?

(a).for(j=0;j<=i;j++)
(b).for(j=i;j>=0;j--)
(c).for(j=0;j<=i;j++)
(d) for(j=i-1;j>=0;j--)
(e) for(j=0;j>=i;j--)

217. What is the output of the program?

void main()
{
float f=20.33301030f;
printf("\n%e,%1.2f,%g",f,f,f);
}
(a). 2.33301e+0120.33,20.33301
(b). 2.033301e+01,20.333,20.33
(c). 2.033301e+01,20.33,20.333
(d). 2.033301e+01,20.33,20.3330103

218. What is the output of the program?

void main()
{
int i=0;
clrscr();
if(i++,--i)
printf("%d,",1);
if(++i,i++)
printf("%d,",2);
i-=2;
if(--i,++i)
printf("%d,",3);
if(i,--i)
printf("%d",4);
}

(a). 1,3,4
(b). 2,4
(c). error at line 4 only
(d). error at line 4 and line 9

219. What is the output of the program?

void main()
{
int a=1,b=2,c=3,d=5;
clrscr();
printf("%d",fun(a));
}
int fun(int x,int y,int z)
{
return z;
}

(a). 3
(b). 1
(c). error
(d). 5

220. What is the output of the program?

main()
{
char buf1[100];
char buf2[100];
char *ptr1;
char *ptr2;
clrscr();
strcpy(buf1,"abcdefghijklmnopqrstuvwxyz");
strcpy(buf2,"LIRD");
ptr1=buf1+6;
strcpy(ptr1,ptr2);
ptr2=ptr1+8;
strcpy(ptr1,buf2,4);
printf("%s",buf1);
printf(",%s",buf2);
return 0;
}

(a). ghijLIRD,LIRD
(b). abcdefLIRD,LIRD
(c). fghiLIRD,LIRD
(d). bcdefgLIRD,LIRD

221. What is the output of the program?

void main()
{
int x;
float y;
if((x=1,10,100)=2.0)
printf("hello");
else
printf("bye");
}

(a). Illegal operation


(b). hello
(c). bye
(d). Lvalue required

222. What is the output of the program?

#define lab(i) printf("\nz"#i"=%f",z##i)

void main()
{
float z1=10;
lab(1);
}

(a). error
(b). z1=10.000000
(c). z=10.000000
(d). z=10.00

223. What is the output of the program?

main( )
{
char buf[50]="Good Luck";
char *pt=buf+5;
char *string1="Indonesia";
char *string2= "o";
int length;
length=strcspn(buf,string2);
strcpy(string1,string2);
memmove(buf,pt,length);
clrscr();
printf("%s",buf);
printf("%d",length);
return 0;
}

(a). Guckonesia6
(b). Luck6
(c). Lood Luck1
(d). Good LuckIndo4

224. What is the output of the program?

main( )
{
int arr[4][3]={{1},{2,3},{4,5,6}};
int huge *arr1=arr;
clrscr();
printf("%d,%d",sizeof(arr1),sizeof(arr));
return 0;
}

(a). 4,12
(b). 2,12
(c). 4,24
(d). 24,24

225. What is the output of the program?

void main( )
{
int a[2][2]={ 1,2,3,4};
int i,j,k;
clrscr();
for(j=0;j<2;j++)
for(k=0;k<2;k++)
printf("%d,%d,",k[a[j]],*(*(a+k)+j));
}

(a). 1,1,3,3,2,2,3,4,
(b). 1,1,2,3,3,2,4,4,
(c). 1,2,2,2,3,3,4,4,
(d). 1,1,2,3,3,2,4,1,

226. What is the output of the program?

void fn(int *p);


void main( )
{
int n=2,*p;
p=&n;
n*=3;
fn(&n);
printf("\n%d",*p**p*n);
}

void fn(int *p)


{
*p++;
}

(a). 216
(b). 36
(c). 49
(d). 294

227. What is the output of the program?

main( )
{
int a=2,b,c;
b=+a+++a+++a;
c=+a+++a+ ++a;
clrscr();
printf("%d,%d,%d",a,b,c);
return 0;
}

(a). 6,6,18
(b). 6,6,12
(c). LValue Required
(d). 6,6,15

228. What is the output of the program?

main ( )
{
int fun( );
int (*ptr)();
clrscr();
ptr=fun;
ptr( );
fun( );
(*ptr)( );
return 0;
}
fun( )
{
printf("pointer to function,");
return 0;
}
(a). Compilation error
(b). Stack Overflow
(c). function fun() is called two times
(d). function fun() is called three times
(e). function fun() is called four times

229. What is the output of the program?

main( )
{
clrscr();
printf("%d",sizeof(" "));
printf(",%d",sizeof("\\\\\\\\\\\\\\"));
printf(",%d",sizeof("\0\0\0"));
printf(",%d",sizeof("/0/0/0"));
return 0;
}

(a). 0,8,3,6
(b). 1,8,4,7
(c). 2,8,4,7
(d). 0,15,4,7

230. What is the output of the program?

main( )
{
int i=0,j=1,k=11;
if(i=j && k&&&*&*&j)
printf("true");
else
printf("false");
printf(",%d",i);
}

(a). true,1
(b). false,0
(c). junk value
(d). true,0

231. What is the output of the program?

main( )
{
char a=64;
clrscr();
a=a-92-(-5);
printf("%d",a);
return 0;
}

(a). incompatible type conversion


(b). -151
(c). –23 (d). error
232. What is the output of the program?

main( )
{
int a;
a=((2<3>4*2<3>2)>>1);
printf("%d",a);
return 0;
}

(a). –1
(b). 1
(c). 0
(d). 2

233. What is the output of the program?

main( )
{
int a,b;
a=(strcmp("123","123"),strcpy("123","123"))?2:3;
b=(strcpy("123","123"),strcmp("123","123"))?2:3;
clrscr();
printf("%d,%d",a,b);
return 0;
}

(a). 2,2
(b). 3,2
(c). 3,3
(d). 2,3

234. What is the output of the program?

main( )
{
enum{one=1,two,three,four=5,five,six};
int a[six]={0};
switch(2)
{
case 1 :
printf("case 1");
break;
case two:
printf("case 2 ");
printf("a[2]=%d",a[two]);
break;
}
return 0;
}

(a). case1
(b). case2 a[2]=0
(c). case2 a[2]=1 (d). case2 a[2]=2
235. What is the output of the program?

int i=20;
main( )
{
clrscr();
i=10;i=i++;
{
i=30;printf("%d,",i++);
{ int i=1;printf("%d,",++i);}
}
printf("%d",i);
return 0;
}

(a). 30,2,30,
(b). 31,2,31,
(c). 31,2,30,
(d). 30,2,31

236. What is the output of the program?

main()
{
char s1[100];
char s2[100];
clrscr();
gets(s1);
gets(s2,sizeof(s2));
printf("%d\n",strlen(s1)-strlen(s2-1));
getch();
return 0;
}

What will be printed when the above code is executed and the
string "abcd" is entered twice on stdin?

(a). -1
(b). 0
(c). 1
(d). 2
(e). 4

237. What is the output of the program?

void call(char *p);

main( )
{
char *p=(char *)malloc(2);
*p='2';
call(p);
clrscr();
printf("%c",*p);
return 0;
}

void call(char *p)


{
p=(char*)malloc(2);
*p=3;
}

(a). junk values


(b). 2
(c). 3
(d). 23

238. What is the output of the program?

char *good( )
{
static char xxx[1024];return xxx;
}
main( )
{
char *g="sing";
clrscr();
strcpy(gofod( ),g);
g=good( );
strcpy(g,"new string");
printf("string = %s",good( ) );
return 0;
}

(a). string=;
(b). string=new string;
(c). string=string;
(d). abnormal program termination

239. What is the output of the program?

main( )
{
char *p="can do it";
clrscr();
if(p=="can do it")
printf("true %s",p);
else
printf("false %s",p);
return 0;
}

(a). false can do it


(b). true
(c). true can do it
(d). Abnormal Program termination
240. What is the output of the program?

main( )
{
int *a, *f( );
a=f( ); (*a)++; a=f( );
return 0;
}
int *f( )
{
static int s=2;
printf("a=%d ",s);
return &s;
}

(a). a=2 a=2


(b). a=2 a=3
(c). a=3 a=3
(d). a=3

241. What is the output of the program?

main( )
{
int i=301;
onetwo(i);
getch( );
return 0;
}
onetwo(char j,char k)
{
printf("%d,%d",j,k);
return 0;
}

(a). 45,45
(b). 45,1
(c). 1.45
(d). 1,1

242. What is the output of the program?

void main( )
{
char far *scr=0x417;
*scr=64;
}

(a). Print Screen key disabled


(b). Caps Lock key enabled
(c). Back Space key disabled
(d). Caps Lock key disabled
243. What is the output of the program?

main( )
{
int c[20];
int a,b,i;
char d[10];
clrscr();
printf("\n%u,",&a);
printf("%u,",&b);
printf("%u,",&i);
printf("%u,",&c);
printf("%u",&d);
return 0;
}

Assume &a=65534

(a). 65524,65522,65520,65470,65510
(b). 65524,65523,65521,65470,65510
(c). 65524,65522,65520,65370,65410
(d). 65524,65522,65520,65518,65516

244. What is the output of the program?

void main( )
{
int a,b;char c;
printf("\n%d,%c,%d;");
}

(a). 0,344,0
(b). X
(c). 0,X,0 (compiler dependent)
(d). junk values

245. What is the output of the program?

void main( )
{
int a,b;
clrscr();
scanf("%d and %d",&a,&b);
printf("%d and %d",a,b);
}

Assume input => a=100, b=12003

(a). 100 and 12100


(b). 100 and 12003
(c). 100 and 12004
(d). 100 and junk value
246. What is the output of the program?

main( )
{
int m,n;
clrscr();
scanf("\n%d %*c %*c %*c %*c %d",&m,&n);
printf("%d %d",m,n);
return 0;
}

If input =>123 456 789 output=>?

(a). 123 89
(b). 123 456
(c). 123 789
(d). 1 9

247. What is the output of the program?

void main( )
{
int i=-1,j=-1,k=0,m;
m=++j&&++i||++k;
printf("\n%d,%d,%d,%d",i,j,k,m);
}

(a). 0,0,0,0
(b). -1,0,1,1
(c). 0,-1,1,1
(d). -1,-1,0,0

248. What is the output of the program?

const int var1=1;


static int var2=2;
void function ( )
{
int var3=3;
static int var4=4;
}

Which of the above variables exists after the function returns


and cannot be accessed from another file?

(a). var1 only


(b). var2 only
(c). var2 and var4 only
(d). var2,var3 and var4 only
249. What is the output of the program?

void listFile(File *f)


{
int c;
while (c=fgetc(f)!=EOF)
{
printf("%d",c);
}
printf("\n");
}

What will be printed when the function above is called with a


pointer to be open a file that contains three characters abc?

(a). abc
(b). 111
(c). 000
(d). the characters ab followed by an infinite number of
c's

250. What is the output of the program?

#include<stdio.h>
char *format="%d";

main( )
{
int x;
myFunc(scnaf &x);
printf("%d\n",x);
}

Referring to the sample code above, which of the following


would be a correct implementation for myFunc?

(a). void myFunc(int *y(const char*,...),int *x){(*y)


(format,x);}
(b). void myFunc(int *y(const char*,...),int *x){(*y)
(format,&x);}
(c). void myFunc(int (*y)(const char*,...),int *x){(*y)
(format,x);}
(d). void myFunc(int (*y)(const char*,...),int *x){(*y)
(format,&x);}
251. What is the output of the program?

252. What is the output of the program?

int y[4]={5,6,7,8};

Which of the following will declare a pointer variable that


points to the array in the sample code above?

(a). int *(yptr[4])=&y;


(b). int *yptr[4]=&y;
(c). int(yptr*)[4]=&y;
(d). int(*yptr)[4]=&y;

253. What is the output of the program?

254. What is the output of the program?

int main()
{
double x=1.0-1/2-1/2;
printf("x=%.2f\n",x);
return 0;
}

(a). x=0.00
(b). x=0.25
(c). x=0.50
(d). x=1.00

255. What is the output of the program?

int main()
{
const int n=5;
int i,array[n];
for(i=0;i<n;i++)
{
array[i]=i;
}
return 0;
}

(a). The code may have problems at run time


(b). The array will be initialized with the numbers 0
through 4
(c). The code will not compile
(d). The code will compile, but not link

256. What is the output of the program?


struct computer
{
int cpuspeed;
char cpuType[10];
};
void main( )
{
struct computer mycomputer;
mycomputer.cpuspeed=366;
mycomputer.cpuType="CELERON";
print("%c\n",mycomputer.cpuType[0]);
}

(a). LVALUE REQUIRED


(b). PRINTS THE CHARECTER "C"
(c). NULL POINTER ASSIGNMENT
(d). NONE OF THE ABOVE

257. What is the output of the program?

#define strange if(c==8)printf("bye");


void main( )
{
int a=5,b=6,c=7;
clrscr();
if(a==b)
strange
else
printf("hi");
}

(a). bye
(b). hi
(c). nothing will be printed
(d). ';' required in line 5

258. What is the output of the program?

#include<stdio.h>
void main( )
{
int a,b;
clrscr( );
printf("%d,%f\n",4.0,4.0);
}

(a). 4,4.000000
(b). 0,0.000000
(c). 0,4.000000
(d). Abnormal program termination

259. What is the output of the program?

#include<string.h>
#include<stdio.h>
main( )
{
char input[16]="abc,d.e,f";
char *p;
p=strtok(input,".");
if(p)
printf("%s\n",p);
return 0;
}

(a).abc,d,e,f
(b). e,f
(c). .e,f
(d). abc,d

260. What is the output of the program?

#define size 10
main( )
{
char a[size]="123456";
printf("result=%X",a[5]);
return 0;
}

(a). result=36
(b). result=6
(c). result=123456
(d). size not defined

261. What is the output of the program?

#include<math.h>
main( )
{
clrscr();
// log 3 = 1.098612
printf("%f,%d",log(exp(3)),exp(log(3)));
return 0;
}

(a). 3.000000,0
(b). 3.0,0
(c). 3.000000,1
(d). 3.0,1

262. What is the output of the program?

#include<stdio.h>
#include<conio.h>
main( )
{
union j
{
int i;
char a;
char b;
}k;
clrscr();
k.i=20;
printf("%d,%d,%d",k.i,k.a);
return 0;

(a). 20,junk,junk
(b). 20,20,20
(c). 20,20
(d). error

263. What is the output of the program?

main( )
{
int x=10,y;
y=++x + ++x;
clrscr();
printf("the value of x,y is:%d %d",x,y);
return 0;
}

(a). 12 21
(b). 12 22
(c). 12 23
(d). 12 24

264. What is the output of the program?

main( )
{
int x,y,z;
x=0;y=1;
z=x && ++y;
printf("The value of x,y,z is:%d,%d,%d",x,y,z);
return 0;
}

(a). 0,1,0
(b). 0,2,0
(c). 0,1,1
(d). 0,2,1

265. What is the output of the program?

main( )
{
int x=0;
clrscr();
while(x<4)
{
printf("hello");
if(x==2)
{ x++;
continue;
}
printf("hello,");
x++;
}
return 0;
}

(a). hellohello,hellohello,hellohellohello
(b). hellohello,hello,hellohellohellohello
(c). hello,hellohellohello,hellohellohello
(d). hellohello,hellohellohello,hello

266. What is the output of the program?

void func(char *swam);


main( )
{
char *swam,s[10]="swam";
clrscr();
swam=&s;
func(swam);
printf("Main: %s",swam);
return 0;
}
void func(char *swam)
{
char *temp="swamswam";
swam=temp;
printf("Func: %s,",swam);
}

(a). Func: swamswam,Main:swamswam


(b). Func: swamswam,Main:swam
(c). Func: junk, Main: swam
(d). Error

267. What is the output of the program?

268. What is the output of the program?

main( )
{
int a=5,b=10,c=4;
clrscr();
if(a=a>>3)
printf("C");
printf("program");
b = a&++b;
c = b|(c|1);
printf("value is :%d,%d,%d",a,b,c);
return 0;
}

(a). program value is 0,0,1


(b). Cprogram value is 0,0,1
(c). program value is 0,0,5
(d). Cprogram value is 0,0,5

269. What is the output of the program?

main( )
{
int *ptr;
char *cptr,c[25]="lird";
clrscr();
cptr=c+4;
printf("The string is %s,",cptr);
ptr=1000;
ptr=++ptr- ++ptr+ --ptr;
printf(" The address is:%d",ptr);
return 0;
}

(a). The string is d, The address is 1001


(b). The string is junk value, The address is 1001
(c). The string is d, The address is 1002
(d). The string is , The address is 1002

270. What is the output of the program?

void func(int,int);
int a;
main( )
{
int b;
clrscr( );
a=100;
b=100;
func(a,b);
printf("The value of a,b is:%d,%d",a,b);
getch( );
return 0;
}
void func(int x, int y)
{
int b;
a=x+y;
b=x+y;
}

(a). The value of a,b is:100,100


(b). The value of a,b is:200,100
(c). The value of a,b is:200,200
(d). The value of a,b is:100,200
271. What is the output of the program?

main( )
{
int a=5,b=6,c=7,x=4,y=1;
clrscr();
x+=!(!((a&&b)&&(b&&c)&&(c&&a)));
y-=!(!((a||b)&&(b||c)&&(c||a)));
printf("%d,%d",x,y);
return 0;
}

(a). 5,0
(b). 6,0
(c). 7,1
(d). 4,1

272. What is the output of the program?

main( )
{ int b[]={10,20,30,40,50};
int i,*k;
clrscr();
k=&b[4]-4;
for(i=0;i<=2;i++)
{
printf("%d,",*k);
k++;
}
return 0;
}

(a). error
(b). 20,30,40,
(c). 30,40,50,
(d). 10,20,30,

273. What is the output of the program?

main( )
{
int x=0,y=0,z;
z=x++ || y++;
clrscr();
printf("The value of x,y,z is:%d,%d,%d",x,y,z);
return 0;
}

(a). 1,0,1
(b). 1,1,1
(c). 1,1,0
(d). 1,0,0
274. What is the output of the program?

void main( )
{
int v,i;
clrscr( );
for(printf("Enter the value:"),scanf("%d",&v);v<=5|3;v++)
{
printf("\nLoop executes");
}
getch( );
}

(a). Loop executes for given number of times


(b). Loop executes for five times
(c). Loop executes for 5|3 times
(d). Loop executes foe infinite times

275. What is the output of the program?

int f1(void);
void main( )
{
int a,b;
clrscr( );
_AX=300;
a=f1( );
printf("%d",a);
getch( );
}

f1()
{
_AX=400;
}

(a). junk value


(b). 300
(c). 400
(d). empty screen

276. What is the output of the program?

#include<stdio.h>
#include<conio.h>
void main( )
{
int a[5]={10,255,256};
clrscr( );
printf("%d,%d,%d",a[0],a[1],a[2]);
memset(a,0,5);
printf(",%d,%d,%d",a[0],a[1],a[2]);
getch( );
}

(a). 10,256,256,0,0,256
(b). 10,255,256,0,255,256
(c). 10,255,256,0,0,0
(d). error

277. What is the output of the program?

void main(void)
{
char a[10]={"dass"},t;
clrscr();
printf("%s,",a);
printf("%u,",&a);
printf("%c,",*a);
printf("%c,",*a+2); //adds content i.e. d to e to f
t=(*a)++; //t=e , a is incremented
t=*a; //no need
printf("%c,",t);
printf("%c,",*(a)); //a=e
printf("%s,",*(&a)); //a=eass
printf("%u,",&(*a)); //same a addr..
printf("%c,",*(a+3)); // adds 3 to array subscript.
a[3]=s
printf("%u",&(&(&(a)))); //same a addr..
getch();
}

assume address of a = 65516

(a). dass,65516,d,s,e,d,dass,65516,s,65516
(b). dass,65516,d,s,e,e,eass,65516,s,65516
(c). dass,65516,d,f,e,e,eass,65516,s,65516
(d). dass,65516,d,f,e,d,dass,65516,s,65516

278. What is the output of the program?

#include <stdio.h>
void main()
{
int i,result1,result2;
i=0x0A;
clrscr();
result1=(i^0x2>>1);
result2=(i&0x2|0x8);
printf("%d,%d",result1,result2);
getch();
}

(a).4,10
(b).4,garbage
(c).error
(d).11,10
279. What is the output of the program?

main()
{
void *l;
int i=63+3;
clrscr();
l=&i;
printf("%d,",*(int *)l);
printf("%c",*(char *)l);
}

(a). 66,garbage
(b). 66,B
(c). error
(d). garbage values

280. What is the output of the program?

main()
{
int x=-2;
clrscr();
while(x++)
{
int x=999;
x--;
printf("%d...",x);
}
return 0;
}

(a). infinite loop


(b). 998... 998...
(c). -2... -1...
(d). error

281. What is the output of the program?

main()
{
(***(int (***)void))o)(float); // actual ///*
(**(void (**)()o)(); */
getch(); /
/change this to your need, try as below ;

(a). compilation error


(b). gives divide by zero error
(c). gets a character
(d). compile but do not run
282. What is the output of the program?

main()
{
int x=-1;
clrscr();
while(x)
{ int y=-3;
printf("%d",y);
y--; x++;
}
}

(a). -3
(b). -4
(c). 3
(d). error

283. What is the output of the program?

main()
{
int huge *near *far *xyz;
printf("%d->%d->%d",sizeof(**xyz),sizeof(*xyz),sizeof(xyz));
return 0;
}

(a). 2->2->2
(b). 4->4->2
(c). 4->4->4
(d). 4->2->4

284. What is the output of the program?

main()
{
char far near **xy;
printf("%d,%d", sizeof(xy),sizeof(*xy));
}

(a). 2,2
(b). error
(c). 4,2
(d). 2,4

285. What is the output of the program?

286. What is the output of the program?

main()
{
int far *far *near *huge *x;
char far *far *near *huge *y;
float far *far *near *huge *z;
clrscr();
printf("%d..%d..%d",sizeof(x),sizeof(y),sizeof(z));
return 0;
}

(a). error
(b). 4..garbage values
(c). 4..4..4
(d). 4..4..garbage values

287. What is the output of the program?

main()
{
int divisor=100,divident=10,result;
int *ptr;
ptr=&divident;
result=divisor / *ptr;
printf("%d",result);
return 0;
}

(a). 10
(b). 100
(c). 1000
(d). error

288. What is the output of the program?

#define PUTE(i,j,k) (i##j+k)


main()
{
int res;
clrscr();
res=PUTE(20,30,40);
printf("%d",res);
return 0;
}

(a). error
(b). 2070
(c). 640
(d). 90
(e). 4200

289. What is the output of the program?

#define MIX(a,b) (a##b)


#define PUT(c,d) (c##d)
main()
{
int result,output;
result=MIX(100,10);
output=PUT(100+10,101+100);
printf("%d,%d",result,output);
getch();
return 0;
}

(a). 10010,110201
(b). error
(c). 10010,10301
(d). 10010,110301

290. What is the output of the program?

file1.h
char duck[]="research Bodies";

file2.c
#include"file1.h"
extern char duck[1];
main()
{
printf("%s",duck);
}

(a). Bodies
(b). error
(c). garbage
(d). research bodies
(e). empty screen

291. What is the output of the program?

main()
{
float x=2,y=2,z;
float a=10,b=2.0,c;
z=x/y;
c=a/b;
printf("%f<->%f",z,c);
return 0;
}

(a). 1.000000<->5
(b). 1<->5.000000
(c). 1.000000<->5.000000
(d). 1<->5

292. What is the output of the program?

#define A123 -10


main()
{
clrscr();
printf("%d,",A123);
printf("%d",printf("%d;,"A123));
return 0;
}

(a). -10,-10,4
(b). error
(c). -10,4,-10
(d). -10,0

293. What is the output of the program?

void main()
{
if(0,1)
{
printf("Day,");
getch();
}
while(1,-2)
{ printf("Night,");
}
}

(a). Night,Night,...
(b). Day,Night,
(c). Day,Night,Night,...
(b). error

294. What is the output of the program?

main()
{
int a=1,b=2;
char c=' ',d='y';
clrscr();
printf("%c,%d,%d");
printf(",%d,%");
printf(",%d,%d",a,b);
return 0;
}

(a). %,1,2
(b). y,2,1,address,%,1,2
(c). 2,1,address,%,1,2
(d). 1,2,address,%,1,2

295. What is the output of the program?

main()
{
int i,j,k;
k=6;
i=7,j=5;
clrscr();
printf("%d,%d,%d");
return 0;
}

(a). empty screen


(b). 7,6,5
(c). 6,5,7
(d). 7,5,6

296. What is the output of the program?

int x=20;
main()
{ extern int y;
printf("%d",y);
change();
printf("%d",x);
return 0;
}
change()
{
int y=200;
printf("%d",y);
return 0;
}

(a). 0,20,200
(b). error : undefined symbol y
(c). garbage value,20,200
(d). all garbage values

297. What is the output of the program?

#include<stdio.h>
int x = 1;
main()
{
clrscr();
printf("%d",foo());
printf("%d",foo());
return 0;
}
int foo()
{
int x;
x++;
return(x);
}

(a). 1,2
(b). 1,1
(c). garbage value
(d). error
298. What is the output of the program?

main()
{
int a=0;
clrscr();
printf("%d");
printf("%d",foo());
printf("%d",foo());
return 0;
}

int foo()
{
static int a=5;
int b=0;
a*2=0;
printf("%d",b);
return (a++);
}

(a). 0 0 5 0 6
(b). 0 0 6 0 6
(c). 0 5 0 6
(d). 0 0 5 0 5
(e). error: Lvalue required

299. What is the output of the program?

file1.h

static char xyz[]="lird";


char xy[]="lird123";

file.c

main()
{
extern char xy[];
extern static char xyz[];
printf("%s",xy);
printf(",s",xyz);
}

(a). lird123,lird
(b). lird,lird123
(c). error
(d). empty screen

300. What is the output of the program?

main()
{
register int x;
int p,*q;
p=&x;
q=&x;
printf("%d %d",p,q);
return 0;
}

(a). error - must take the address of a memory location


(b). error - p is not a pointer variable
(c). prints the address of x 2 times
301. What is the output of the program?

void main(argc,argv)
{
int argc;
char *argv[];
printf("Hai");
}

(a). Hai
(b). error : multiple declaration for argc and argv
(c). error : size of arhv is unknown or zero
(d). both (b) and (c)

302. What is the output of the program?

void main()
{
char str[10];
//input: Love India
scanf("%[^\n]s",str);
printf("%s",str);
}

(a). Love India


(b). Love
(c). India
(d). Error

303. What is the output of the program?

void main()
{
int i=0;
clrscr();
if(i++,--i)
printf("%d",i);
if(++i,i++)
printf("%d",2);
i=-2;
if(++i,--i)
printf("%d",3);
if(-i,--i)
printf("%d",4);
}

(a). 234
(b). 34
(c). 4
(d). other values
304. What is the output of the program?

void main()
{
char *t1,*t2,*t3;
t3=strcat(t2,strcpy(t1,"welcome"));
printf("%s..%s..%s",t1,t3,t2);
}

(a). null pointer assignment


(b). error: invalid indirction
(c). welcome..welcome..welcome
(d). garbage values

305. What is the output of the program?

void main()
{
char t1[]="Hai",t2="Bai",t3[]="gay";
int i;
i=(t1<t2&&t2<t3)?1:2;
printf("%d",i);
}

(a). 1
(b). 2
(c). error: non portable pointer conversion
(d). error: array size not declared

306. What is the output of the program?

void main()
{
char t1[7][5]={"ABC","DEF","GE","HIJ","KLM","NOP"};
int i,j;
clrscr();
for(i=0;i<7;i++)
for(j=i+1;strcmp(t1[i],t1[j])!=0&&j<7;j++))
printf("%s",t1[i]);
}

(a).
ABCABCABCABCABCABCDEFDEFDEFDEFDEFGEGEGEGEHIJHIJHIJKLMKLMNOP
(b). ABCABCABCABCABCDEFDEFDEFDEFDEFGEGEGEGEHIJHIJHIJKLMKLMNOP
(c). ABCABCABCABCABCABCDEFDEFDEFDEFDEFGEGEGEJHIJKLMKLMNOP
(d). error: expression syntax
(e). error: for statement missing ;

307. What is the output of the program?

void main()
{
char t1[];
//input t1=susan
scanf("%d",t1);
printf("%s",t1);
}

(a). compilation error


(b). prints garbage value
(c). susan
(d). runtime error

308. What is the output of the program?

void main()
{
char t1[20]="Hai";
clrscr();
char t2[12]="the";
if(strcmp(t1,t2)>0)
printf("Greater");
else
printf("Less");
}

(a). Less
(b). Greater
(c). error

309. What is the output of the program?

void main()
{
char s1[20]="Be colorful";
char *s2=s1;
clrscr();
printf("%05d..%05d",sizeof(s1),sizeof(s2));
}

(a). 00011..00011
(b). 00020..00011
(c). 00020..00020
(d). 00020..00002

310. What is the output of the program?

void main()
{
char t1[]="Technological";
printf("%s",t1+10);
}

(a). gical
(b). cal
(c). al
(d). Technological
311. What is the output of the program?

void main()
{
char t1[7] [5]={"ABC","DEF","GE","HIJ","KLM","NOP"};
int i,j;
clrscr();
for(i=0;i<7;i++)
for(j=i;t1[i]!=t1[j];j++)
printf("%s",t1[i]);
}

(a). empty screen


(b). error: strcmp should be used
(c). ABC DEF GE HIJ KLM NOP
(d). garbage values

312. What is the output of the program?

void main()
{
struct buf
{
int x;
float y;
}s1;
clrscr();
// Input : 12
scanf("%f",s1.y);
printf("%d,%f",s1.x,s1.y);
}

(a). garbage value,12.000000


(b). error: scanf: floating point formats not linked
Abnormal program termination
(c). 0,12.000000
(d). 1,12.000000

313. What is the output of the program?

void main()
{
int a,b;
//input : A
clrscr();
while((a=getchar())+1)
{
putchar((b=64^a&223)&&b<27?a&96|(b+12)%26+1:a);
break;
}
return 0;
}
(a). A
(b). N
(c). garbage value
(d). error

314. What is the output of the program?

void main()
{
#include<stdio.h>
#include<conio.h>

char *-="Hello World";


clrscr();
printf("%s",*-);
printf("\t%s",-);
}

(a). Hello
(b). World
(c). error
(d). garbage value, Hello World

315. What is the output of the program?

main()
{
char a[]="LIRD";
char *b="LIRD";
clrscr();
printf("%d,",sizeof(a),sizeof(b));
printf("%d",sizeof(*a),sizeof(*b));
return 0;
}

(a). 4,4,1,1
(b). 5,2,1,1
(c). 5,5,1,1
(d). 5,1

316. What is the output of the program?

void main()
{
char mess[2][40]={"abcdefgh","ijklmnopqrstuvwxyz"};
clrscr();
printf("%c,%c",*(*mess+2),*(*(mess+1)+8));
}

(a). c,q
(b). b,p
(c). error
(d). garbage value
317. What is the output of the program?

void main()
{
float a=0.5,b=0.7;
clrscr();
if(b<0.7)
{
if(a<0.5)
printf("Hello");
else
printf("Ask me");
}
else
printf("Hai");
}

(a). Hello
(b). Ask me
(c). Garbage Value
(d). Error

318. What is the output of the program?

main()
{
extern int a; //int a=30;
printf("%d",a);
return 0;
}

In the above code where is the variable getting declared &


defined ?

(a).
(b).
(c).
(d).

319. What is the output of the program?

main()
{
xyz("%d",10);
return 0;
}

(a). udefined symbol _xyz in the module


(b). expression syntax
(c). unterminated string or character constant
(d). both (b) and (c)
(e). all (a), (b) and (c)
320. What is the output of the program?

int change(int x)
{
if(x<=1)
x = 1;
else
x =change(x-3)+change(x-1);
return x;
}

main()
{
int result=0;
clrscr();
result=change(6);
printf("%d",result);
return 0;
}

(a). 8
(b). 9
(c). 6
(d). 12
(e). 15

321. What is the output of the program?

int i=1;
main()
{
clrscr();
switch(i)
{
case 1:
i++;
case 2:
++i;
break;
case 3:
--i;
}
printf("%d",i);
return 0;
}

(a). 3
(b). 2
(c). 1
(d). error
322. What is the output of the program?

main()
{
char *p="Dass Lab";
int i;
clrscr();
for(i=0;i<strlen(p);i++);
printf("%c",*(p++));
return 0;
}

(a). Dass Lab


(b). Dass
(c). D
(d). Error

323. What is the output of the program?

main()
{
int x,y;
x=200,y=-20;
clrscr();
fire(x,y);
return 0;
}

int fire(int z)
{
printf("%d",z);
return 0;
}

(a). error
(b). 200
(c). -20
(d). 180

324. What is the output of the program?

main()
{
char x='z';
if(x=='z'||x=='y')
x='a';
clrscr();
printf("%x",x);
return 0;
}

(a). error
(b). z
(c). y
(d). 61
(e). garbage value

325. What is the output of the program?

#define MODUCHECK(a,b) if((a)>(b)) printf("A>B"); else

main()
{
int l=-2,m=-1;
clrscr();
if(l<0&m<0)
MODUCHECK(l,m);
else
printf("Foolish");
return 0;
}

(a). Foolish
(b). A>B
(c). empty screen
(d). error
(e). garbage value

326. What is the output of the program?

#define MODUCHECK(a,b) (((a)>=(b))|| printf("small"))

main()
{
int x=2,y=-1;
clrscr();
if(x>0&&y<0)
MODUCHECK(y,x);
else
MODUCHECK(x,y);
return 0;
}

(a). error
(b). small
(c). garbage value
(d). empty screen

327. What is the output of the program?

file1.c
static char x[]="lird";

file2.c
#include "file1.c"
extern int x;
main()
{
printf("%d",x);
}

(a). Prints the ASCII values


(b). error : type mismatch in redeclaration of x
(c). 0
(d). junk values

328. What is the output of the program?

main()
{
int result;
float box[4];
clrscr();
result=change(box);
printf("%d,",result);
printf("%d",box[3]);
return 0;
}

change(char box[])
{
box++;
box[2]=999;
box--;
}

(a). 0,0
(b). garbage value,0
(c). 0,garbage value
(d). all junk values

329. What is the output of the program?

main()
{
int sum,res;
int num[10];
res=add(num);
clrscr();
printf("%d",num[2]);
printf(",%d",res);
return 0;
}

add(int num[8])
{
num++;
num[1]=999;
//return 0;
}
(a). 999,junk value
(b). 0,999
(c). 999,0
(d). 0,junk value
(e). error

330. What is the output of the program?

331. What is the output of the program?

void main()
{
float x,y;
x=999;
y=99;
fixbug(y,x);
}

fixbug(char x,char y)
{
printf("%d,%d",y,x);
}

(a). 999,99
(b). error
(c). address or ASCII value
(d). 0,0

332. What is the output of the program?

# define bug ERROR


main()
{
printf("%s",bug);
return 0;
}

(a). udefined symbol ERROR


(b). ERROR
(c). size of string not defined
(d). abnormal program termination

333. What is the output of the program?

# define light "SUN"

main()
{
char *ptr;
clrscr();
printf("%s",light);
printf("\t%c",light);
ptr=light;
printf("%s",ptr);
return 0;
}

(a). error: Lvalue required


(b). error: undefined symbol SUN
(c). SUN,Ascii character,SUN
(d). garbage values

334. What is the output of the program?

# define light "MOON"


int global = 999;

main()
{
char *ptr , *opr;
clrscr();
ptr=light;
opr=global;
fixitdamn();
printf("%d,%s",ptr,opr);
return 0;
}

fixitdamn()
{
printf("%d,",global);
}

(a). 999,junk,999
(b). 999,MOON,999
(c). 999,junk
(d). error

335. What is the output of the program?

unsigned int a=-999;


main()
{
unsigned int c=-1;
clrscr();
printf("%d,%u,",c,c);
printf("%u,%d",a,a);
return 0;
}

(a). -1,-1,-999,-999
(b). -1,1,999,-999
(c). -1,garbage,garbage,-999
(d). garbage,1,1,garbage
(e). error

336. What is the output of the program?


#define error "BUG"; fix();

int main()
{
char *ptr=error;
clrscr();
fix();
printf("%s",ptr);
return 0;
}

fix()
{
printf("Hai,");
}

What happens if you change the define statement as follows?


#define error "BUG"; int fix();

(a). error: type mismatch in redeclararion of fix()


(b). no change

337. What is the output of the program?

void main()
{
int a,b;
unsigned int c,d;
a = 0; c = 0;
b = ~a; d = ~c;
clrscr();
printf("%d,%d",a,b);
printf(",%d,%d",c,d);
printf(",%u,%u",c,d);
}

(a). 0,1,0,1,0,1
(b). 0,-1,0,-1,0,1
(c). 0,-1,0,-1,0,-1
(d). 0,-1,0,-1,0,65535

338. What is the output of the program?

void main()
{
char n[-5+2]={'a','b','c'};
char p[-10]="xyz";
printf("%c,%c",n[-1],p[-2]);
}

(a). error: Array must have atleast one element


(b). error: Two many initializers
(c). b,z
(d). both (a) and (b)
(e). a,x

339. What is the output of the program?


//What happens if the printf statement is not given in the
main() funtion?

# include<stdio.h>; int sum=-1;

main()
{
printf("%u",sum);
return 0;
}

question 1:

(a). error
(b). 1
(c). -1
(d). 65535

question2:

(a). error
(b). empty screen

340. What is the output of the program?

main()
{
char c='a';
# include<stdio.h>;
printf("%c",c);
return 0;
}

(a). compilation error


(b). a
(c). c
(d). runtime error

341. What is the output of the program?

342. What is the output of the program?

main()
{
char ptr='ab';
#include<stdio.h>;
doitguys();
return 0;
}

doitguys()
{
# include<conio.h>
# include<dos.h>
printf("Hai");
exit();
}

(a). error: Type mismatch in redeclaration of printf


(b). error: Non portable pointer conversion
(c). Hai
(d). both (a) and (b)

343. What is the output of the program?

main()
{
char ***a;
char **b,*c;
clrscr();
c="Jacobi";
b=&c;
a=&b;
printf("%d, %c, %s, %s, %s" ,a,a,a,*b,*(&c) );
return 0;
}

(a). address,garbage,garbage,garbage,garbage
(b). address,garbage,garbage,address,garbage
(c). address,garbage,garbage,Jacobi,Jacobi
(d). address,garbage,jacobi,Jacobi,Jacobi

344. What is the output of the program?

main()
{
char *x;
x="Dameon\0Hai";
printf("%c,%c,%c",*x[1],*&x[0],*(&x));
printf(",%c",*&x[6]);
printf(",%c",*x[6]);
}

(a). error : invalid indirection


(b). a,D,D,,garbage value
(c). a,D,garbage,garbage,garbage
(d). a,D,garbage,garbage,

345. What is the output of the program?

main()
{
char *ptr,**hexu;
hexu = "Alzebra";
ptr = "OperationsResearch";
clrscr();
printf("%c,%c",*&*ptr,hexu);
printf(",%c",*&ptr[10]);
}

(a). O,garbage,e
(b). error
(c). O,A,e
(d). O,garbage,R

346. What is the output of the program?

347. What is the output of the program?

main()
{
int x;
x=0;
printf("%c",x);
return 0;
}

(a). prints its ASCII character


(b). prints nothing
(c). shows some warning
(d). shows an error

348. What is the output of the program?

# define i i=10
# ifdef i
i=-2;
# endif

main()
{
int i; i;
printf("%d",i);
return 0;
}

(a). -2
(b). error
(c). 2
(d). junk
(e). 0

349. What is the output of the program?

# define i i = -3
# ifdef i
// i=10;
# endif
main()
{
int i; //= -20;
clrscr();
printf("%u,",i);
printf("%d",i);
return 0;
}

(a). error
(b). -3,-3
(c). garbage value,-3
(d). garbage values

350. What is the output of the program?

main()
{
union {
float f;
char c;
}uni;
union{
float f;
char c;
}str;
clrscr();
uni.c='ab';
printf("%f,",uni.f);
str.f = 198.4;
printf("%d",str.c);
return 0;
}

(a). 0.000000, junk values


(b). -0.000000, junk values
(c). error
(d). junk values

351. What is the output of the program?

main()
{
char *ptr;
ptr="Object";
ptr[2] = 'a';
clrscr();
printf("%s,",ptr);
ptr= "%d";
printf(ptr,64);
}

(a). error
(b). Obaect,64
(c). Object,64
(d). Object,Garbage value

352. What is the output of the program?

main()
{
char *a,*b;
a="%d";
--a;
a--;
b=a;
clrscr();
printf(b+2,707);
return 0;
}

(a). error
(b). garbage value
(c). blank screen
(d). 707

353. What is the output of the program?

main()
{
char *a,*b,*c;
a="%d,%d";
--a;
a--;
b = a+4;
clrscr();
printf(b,707);
return 0;
}

(a). error
(b). 707,garbage
(c). 707,
(d). garbage,707
(e). ,707

354. What is the output of the program?

main()
{
unsigned int fix;
int bug = -25;
fix = -25;
if (fix==bug)
printf("You fool");
else
printf("%d",((-fix) + (-bug)));
return 0;
}

(a). you fool


(b). 50
(c). 0
(d). error

355. What is the output of the program?

float modify(float f);


float f=10.04;
main()
{
float f=5.02;
modify(f=f/5.02);
printf("%f",f);
return 0;
}

float modify(float f)
{
f=f/2;
return f;
}

(a). error: Multiple redeclaration of f


(b). 1.000000
(c). 0.500000
(d). 2.071713

356. What is the output of the program?

float modi(float y);


float x=6.6;
main()
{
float x=3.3;
printf("%f",modi(x=x/3.3));
return 0;
}

float modi(float y)
{
return y/3;
}

(a). 0.333333
(b). 0.000000
(c). 1.000000
(d). 2.000000

357. What is the output of the program?

unsigned int i=-3;


main()
{
unsigned int i;
for(i=-5;i<=-1;i--)
{
i++;
}
printf("%u",i);
return 0;
}

(a). 62767,6274,62764
(b). 5,5,5
(c). endless loop
(d). error

358. What is the output of the program?

struct abc{
int a;
char b;
};

struct def{
int a;
char b;
};

main()
{
struct abc x={9,'k'};
struct def y;
clrscr();
dishum(x);
return 0;
}

dishum(struct def y)
{
printf("%d,%c",y.a,y.b);
}

(a). error
(b). junk values
(c). 9,k
(d). empty screen

359. What is the output of the program?

main()
{
int b=100;
char c='abcdef';
printf("%c",c);
return 0;
}

(a). a
(b). abcdef
(c). compilation error
(d). run time error

360. What is the output of the program?

main()
{
int x=99;
int a=90,b=10;
clrscr();
x = sum(a,b) == x ;
printf("%d,",x);
x = sum(b,a) == 100;
printf("%d",x);
return 0;
}

sum(int a,int b)
{
int c;
c=a+b;
return c;
}

(a). 0,0
(b). 99,100
(c). 100,100
(d). 0,1

361. What is the output of the program?

extern char a;
main()
{
printf("%c",a);
}

(a). blank screen


(b). garbage value
(c). error: undefined symbol a
(d). other errors

362. What is the output of the program?

auto float f; //1


main() //2
{
register int x=0; //3
printf("%u",&x); //4
return 0;
}

(a). error at line 1


(b). error at line 4
(c). 0
(d). both (a) and (b)

363. What is the output of the program?

main()
{
int a,b,c;
clrscr();
a=2;b=1;c=0;
c=a++ + ++a;
a=-b++ + ++b;
b=c+++c;
printf("%d,%d,%d",a,b,c);
return 0;
}

(a). 2,12,7
(b). 0,12,7
(c). 1,12,7
(d). error

364. What is the output of the program?

main()
{
char *x,*y;
x="Research","Labs";
y="Operation " "Success";
printf("%s,%s",x,y);
return 0;
}

(a). Research,Operation Success


(b). Research,Operation
(c). ResearchLabs,Operation
(d). ResearchLabs,OperationSuccess
(e). error

365. What is the output of the program?

main()
{
struct abc{
int a;
char b;
float c;
}*head;
int d;
d=sizeof(head);
printf("%d",d);
return 0;
}

(a). 7
(b). 2
(c). 4
(d). 3

366. What is the output of the program?

main()
{
char *a,b[9]="Adventure";
a="Joyful";
clrscr();
printf("%0.4s",a);
printf(",%c5s",b);
return 0;
}

(a). Joyf, Adventure


(b). Joyf,Adven
(c). Joyfyl,Adven
(d). Joyf, Adventure
(e). Joyf, garbage value

367. What is the output of the program?

main() //1
{
int a; //2
float b; //3
int c; //4
a=9/0; //5
b=0.0/0.0; //6
c=0/0; //7
printf("%d,%d,%d",a,b,c);
return 0;
}

(a). error: Division by zero


(b). warning: Division by zero at line 5 and 7
(c). warning: Division by zero at line 5 ,6 and 7
(d). 9,0,0
(e). both (b) and (d)
(f). both (c) and (d)

368. What is the output of the program?

369. What is the output of the program?

main()
{
int i=3;
do{
i--;
printf("Hai");
continue;
}while(i);
return 0;
}

(a). HaiHaiHai
(b). HaiHai
(c). The Loop will not end
(d). Hai

370. What is the output of the program?

# if 1
int a;
#if 1
float b;
# endif
#endif

main()
{
int a=999;
float b=888;
clrscr();
printf("%d,%f",a,b);
return 0;
}

(a). error: multiple redeclaration of a and b


(b). 999,888.000000
(c). 999,888
(d). other errors

371. What is the output of the program?

# if 1
char a;
#if 0
int b;
# endif
#endif

main()
{
char a = 'A';
int b = 987;
clrscr();
printf("%c,%d",a,b);
return 0;
}

(a). A,987
(b). error: Undefined symbol b
(c). garbage values
(d). empty screen

372. What is the output of the program?

#define xyz(m,n) m=100 - 'A' + n


main()
{
int m;
clrscr();
m=xyz(m,10);
printf("%d",m);
return 0;
}

(a). 46
(b). 47
(c). 48
(d). 45

373. What is the output of the program?

main()
{
int a,b;
a=3; b=2;
a = a+b + b++ /a-b;
b = a+b - ++b/b-a;
clrscr();
printf("%d",a);
printf(",%d",b);
return 0;
}

(a). 3,3
(b). 4,2
(c). 3,2
(d). error: cannot divide by zero

374. What is the output of the program?

main()
{
int x,y,z,a,b;
a=6; b=1;
x=7; y=0;
z = a+y+ ++a/-x;
x = a+b+++z;
clrscr();
printf("%d,%d",z,x);
return 0;
}

(a). 6,15
(b). 5,14
(c). 6,14
(d). 5,15

375. What is the output of the program?

main()
{
int a,b,c;
a=1; b=2; c=3;
a =+ +a;
b =- -b;
c =- +c;
clrscr();
printf("%d,%d,%d",a,b,c);
return 0;
}

(a). 1,2,3
(b). 1,2,-3
(c). 2,1,-3
(d). error

376. What is the output of the program?

main()
{
int a=6;
char arr[a]="lird";
clrscr();
arr[a-1]="l";
arr[a-2]="i";
arr[a-3]="r";
arr[a-4]="d";
printf("%s",arr);
return 0;
}

(a). error: constant expression required


(b). error: non portable pointer inclusion
(c). lidril
(d). both (a) and (b)

377. What is the output of the program?

main()
{
int x=5.3;
if(x--=4)
printf("A");
else if (++x=5)
printf("B");
else if(++x==7)
printf("C");
return 0;
}

(a). error: Lvalue required


(b). A
(c). B
(d). C

378. What is the output of the program?

# include<stdio.h>
# include<conio.h>
int main()
{
int main[]={1,2,-23,0x12,'d','r','a','j'};
clrscr();
printf("%d",main[1]);
return 0;
}

(a). error: multiple declaration of main.


(b). 1
(c). 2
(d). empty screen

379. What is the output of the program?

# include<stdio.h>
# include<conio.h>
int main[]={1,2,-23,0x12,'d','r','a','j'};
int main()
{
printf("%d",main[1]);
return 0;
}

(a). 1
(b). error :multiple declaration for main
(c). 2
(d). empty screen

380. What is the output of the program?

# include<stdio.h>
# include<conio.h>
int main()
{
char z[]={"testing"};
z=*z+1;
printf("%s",z);
printf(",%s",z-1);
return 0;
}

(a). esting,testing
(b). testing,testing
(c). error: Lvalue required
(d). garbage values

381. What is the output of the program?

382. What is the output of the program?

# include<stdio.h>
# include<conio.h>
void main()
{
int x,*y;
char c;
x=20;
y=&x;
printf("address = %u",y);
(char*)y;
printf(",x after cast = %s",y);
}

(a). address,garbage
(b). address,some characters
(c). compilation error
(d). runtime error

383. What is the output of the program?

# include<stdio.h>
# include<conio.h>
int main()
{
int x=10,y=20;
if(x&0x31)
printf("1");
else
printf("0");
return 0;
}

(a). 0
(b). 1
(c). can't AND a CPU data

384. What is the output of the program?

int main()
{
static int i=3;
clrscr();
for(i=0; i<5;i++)
printf("Good");
printf("Done");
return 0;
}

(a). error since static integer i value cannot be changed


inside loop
(b). GoodGoodGoodGoodGoodDone
(c). GoodGoodGoodGoodDone
(d). GoodGoodGoodDone

385. What is the output of the program?

#include<time.h>
int main()
{
clrscr();
printf("%d",CLK_TCK);
return 201;
}

(a). prints number of clock ticks at program start


(b). prints number of clock ticks at the random rate
(c). prints number of clock ticks per second 13107
(d). prints number of clock ticks at program end

386. What is the output of the program?

#define short_cut(i) printf("\nz"#i"=%f",z##i)


void main()
{
float z=10,z1;
clrscr();
short_cut(1);
}

(a). error
(b). z1=10.000000
(c). z=10.000000
(d). z1=-0.000000

387. What is the output of the program?

main()
{
int arr[4][3]={{1},{2,3},{4,5,6}};
int huge*arr1=arr;
printf("%d,%d",sizeof(arr1),sizeof(arr));
return 0;
}

(a). 4,12
(b). 2,12
(c). 4,24
(d). 24,24

388. What is the output of the program?

void fn(int *p);


void main()
{
int n=2,*p;
p=&n;
n*=3;
fn(&n);
clrscr();
printf("%d",*p**p*n);
}
void fn(int *p)
{
*p++;
}

(a). 216
(b). 36
(c). 49
(d). 294

389. What is the output of the program?

void main()
{
int a;
float b;
clrscr();
if((a=1,10,100)==2.0)
printf("Hello");
else
printf("Bye");
}

(a). Illegal Operations


(b). Hello
(c). Bye
(d). Lvalue Required

390. What is the output of the program?

main()
{
int m,n;
scanf("\n%d %*c%*c%*c%*c%d",&m,&n);
clrscr();
printf("%d,%d",m,n);
return 0;
}
//if input=> 123 456 789 output=>?

(a). 123,89
(b). 123,456
(c). 1,9
(d). 123,789

391. What is the output of the program?

main()
{
char *p="persons";
clrscr();
if(p=="persons")
printf("technical %s",p);
else
printf("true %s",p);
return 0;
}

(a). technical persons


(b). technical
(c). true persons
(d). abnormal program termination

392. What is the output of the program?

struct comp
{
int speed;
char type[10];
};

int main()
{
struct comp mine;
mine.speed = 1000;
mine.type="PENTIUM";
printf("%c",mine.type[0]);
return 0;
}

(a). null pointer asignment


(b). prints the character P
(c). Lvalue required
(d). none of the above

393. What is the output of the program?

# define size 10
void main()
{
char a[size]="987654";
clrscr();
printf("result=%X",a[5]);
}

(a). size not defined


(b). result=4
(c). result=74
(d). result=987654

394. What is the output of the program?

#include<math.h>
main()
{
clrscr();
printf("%f ,%d",log(exp(3.0)),exp(log(3.0)));
return 0;
}

(a). 3.000000,0
(b). 3.000000,1
(c). 3.0,0
(d). 3.0,1

395. What is the output of the program?

int main()
{
double x=1.0 -1/2 - 1/2;
clrscr();
printf("x=%.2f",x);
return 0;
}

(a). x=0.00
(b). x=0.25
(c). x=0.50
(d). x=1.00

396. What is the output of the program?

main( )
{
int a,b;
a=5;b=3;
a=-b+a-2;
clrscr();
switch(a)
{
case 0:printf("hai");
case 1:printf("bye");
}
return 0;
}
(a). hai
(b). haibye
(c). bye
(d). no output

397. What is the output of the program?

#define char int


#define float int
#define int char
main( )
{
char c='A';
clrscr();
printf("%s",c);
printf("\t%d",sizeof(c));
return 0;
}

(a). runtime error


(b). garbage,1
(c). A,1
(d). compilation error

398. What is the output of the program?

main( )
{
int i={989,777};
int a=(999,777);
clrscr();
printf("%d,%d",i,a);
return 0;
}

(a). 989,999
(b). 989,777
(c). error

399. What is the output of the program?

main( )
{
char abc[4][3]={"abc","def","monp"};
clrscr();
printf("%s",&abc[0][0]);
return 0;
}

(a). a
(b). abc
(c). abcdefmonp
(d). error
400. What is the output of the program?

main( )
{
char abc[][2]={'a','b','c','d','e','f','g','h'};
clrscr();
printf("%s",abc[1]);
return 0;
}

(a). bcd
(b). abc
(c). cde
(d). def
(e). cdefgh
101. ans: (a)

reason: any pointer size is 2. What happens at tcc -h q101?


size = 4

102. ans: (a)

103. ans: (c)

reason: self

104. ans: error

reason: structure variables cannot be initialized inside


itself

105. ans: (d)

reason : program terminates . correct strcat(result,"!");

106. ans: (c)

107.

108.

109. ans: (b)

reason: you cannot modify a constant object

111. ans: (a)

112. ans: (a)

113. ans: (b)

114. ans: (a)

115. ans: (b)

116. ans: (a)

117. ans: (c)

118.
119. ans: (d)

120. ans: (d)

121. ans: (d)

122. ans: (c)

123. ans: (c)

124. ans: (a)

125. ans: (c)

126.

127. ans: (a)

128.

129. ans: (d)

130. ans: (c)

131. ans: (c)

132. ans: (a)

133. ans: (b)

134. ans: (c)

135. ans: (d)

136. ans: (b)

137. ans: (c)

138. ans: (a)

139. ans: (a)

140. ans: (c)

141. ans: (d)

142. ans: (a)

143.

144.

145. ans: (b)


146. ans: (a)

147. ans: (f)

148. ans: (b)

149.

150. ans: (a)

reason : you cannot declare variables after main() and before


{}.

151. ans: (c)

reason :self

152. ans: (b)

reason : function is called using (*fp[3])(). see schaum's


series book
for more details.

153. ans: (a)

reason : junk values will be printed

154.

155. ans: (c)

reason : the operator with in () must be accompanied with


operand.
(*&) will be correct if changed to (*&y).Then the o/p will be
(a).

156. ans: (a)

reason : not found

157. ans: (c)

reason : you must assign atleast one bit in the bit field
transmit.

158. ans: (c)

reason : you cannot assign y without declaring it before


assigning.

159. ans: (d)

reason : the trans is assigned with 2 bits only.


7 is stored as 0000 0111. only 2 bits of LSB is taken.
i.e. binary 11 = decimal 3. note 'unsigned int : 4;'
statement has no variable but still works.

160. ans: (a)

reason : self

161. ans: (d) reason : self

162. ans: (a)

reason : self

163. ans: (d)

reason : you cannot assign y=z before declaring z. put int x,z
then o.k.

164. ans: (b)

reason : not found

165. ans: (c)

reason : the current value in the acc.. is returned.

166. ans: (a)

reason: not found

167. ans (c)

168. ans: (c)

reason : not found

169. ans: (c)

reason : self explanatory

170. ans (d)

171. ans (b)

172. ans (b)

173. ans (a)

174. ans (b)

175. ans (a)


176. ans (b)

177. ans (a)

178. ans (a)

reason: the pointer members in struct must be accesed by ->

179. ans (e)

180. ans (d)

181. ans: (a)

reason: % is used print as such that follows it.

182. ans (c)

183. ans: (b)

184. ans (d)

185. ans (b)

186. ans (b)

187. ans: (b)

reason: local array and formal array.

188. ans (c)

189. ans: (b)

reason: the last assigned value in union resides. because


union can handle
only one value at a time.

190. ans (b)

191.

192. ans: (c)

193. ans (e)

194. ans: (c)

195. ans: (c)

196. ans: (b)

197. ans: (a)


198. ans: (b)

199. ans: (d)

200. ans: (c)

201. ans: (b)

202. ans: (c)

203. ans: (a)

204. ans: (a)

205. ans:

206. ans: (e)

207. ans: (b)

208. ans: (b)

209. ans: (b)

reason : operator within () must have operand. i.e.(+x) is


right, but will
not print 5. be careful.

210. ans: (c)

211. ans: (e)

212. ans: (c)

213. ans: (b)

214. ans: (d)

reason: static variables must be assigned with values not the


references.
bb = 20 is correct.

215. ans: (c)

216. ans: (d)

217. ans: (c)

218. ans: (b)

219. ans: (a)

220. ans: (b)


221. ans: (d)

222. ans: (b)

223. ans: (c)

224. ans: (c)

225. ans: (b)

226. ans: (a)

227. ans: (d)

228. ans:

229. ans:

230. ans:

231. ans: -23

232. ans: (c)

233. ans: (d)

234. ans: (b)

235. ans: (d)

236. ans: 4

237. ans: (b)

238. ans:

239. ans: (a)

240. ans: (b)

241. ans: (a)

242. ans: (b)

243. ans: (a)

244. ans: (c)

245. ans: (d)

246. ans: (a)

247. ans:(b)
248. ans:

249. ans:

250. ans:

251.

252.

253.

254.

255. ans: (a)

256.

257. ans: (c)

258. ans: (b)

259. ans: (d)

260. ans: (a)

261. ans: (c)

262. ans: (b)

263. ans: (d)

264. ans: (a)

265. ans: (a)

266. ans: (b)

267.

268. ans: (c)

269. ans: (d)

270. ans: (b)

271. ans: (a)

272. ans: (d)

273. ans: (c)

274. ans: (d)


275. ans: (c)

276. ans: (a)

277. ans: (c)

reason: self

278. ans : (d)

reason: self

279. ans: (b)

280. ans: (b)

281. ans: (a)

282. ans: (a)

283. ans: (d)

284. ans: (b)

285.

286. ans: (c)

287. ans: (a)

288. ans: (b)

289. ans: (c)

290. ans: (b)

291. ans: (c)

292. ans: (d)

293. ans: (c)

294. ans: (b)

295. ans: (c)

296. ans: (b)

297. ans:

298. ans: (e)

299. ans: (c)


300. ans: (a)

301. ans: (d)

302.

303. ans: (a)

304. ans: (a)

305. ans: (c)

306. ans: (d)

307. ans: (a)

308. ans: (c)

309. ans: (d)

310. ans: (b)

311. ans: (a)

312. ans: (b)

313. ans: (b)

314. ans: (c)

315. ans: (d)

316. ans: (a)

317. ans: (b)

318.

319. ans: (a)

320. ans: (b)

321. ans: (a)

322. ans: (c)

323.

324. ans: (d)

325. ans: (c)

326. ans: (b)


327. ans: (b)

328. ans: (b)

329. ans: (a)

330.

331. ans: (a)

332. ans: (a)

333. ans: (c)

334. ans: (c)

335. ans: (c)

336. ans: (b)

337. ans: (d)

338. ans: (d)

339. ans: (a) and (b)

340. ans: (b)

341.

342. ans: (a)

343. ans: (c)

344. ans: (a)

345. ans: (d)

346.

347. ans: (b)

348. ans: (b)

349. ans: (c)

350. ans: (b)

351. ans: (b)

352. ans: (d)

353. ans: (e)


354. ans: (a)

355. ans: (b)

356. ans: (a)

357. ans: (c)

358. ans: (c)

359. ans: (c)

360. ans: (d)

361. ans: (c)

362. ans: (d)

363. ans: (b)

364. ans: (a)

365. ans: (b)

366. ans: (e)

367. ans: (e)

368.

369. ans: (a)

370. ans: (b)

371. ans: (a)

372. ans: (d)

373. ans: (a)

374. ans: (c)

375. ans: (b)

376. ans: (d)

377. ans: (a)

378. ans: (c)

379. ans: (b)

380. ans: (c)


381.

382. ans: (a)

383. ans: (a)

384. ans: (b)

385. ans: (c)

386. ans: (d)

387. ans: (c)

388. ans:

389. ans: (c)

390. ans: (d)

391. ans: (c)

392. ans: (c)

393. ans: (b)

394. ans: (b)

395. ans: (d)

396. ans: (b)

397. ans: (a)

398. ans: (c)

399. ans: (d)

400. ans: (e)