You are on page 1of 7

NAME ______________

ROLLNO.______________________
TIME : 55 MIN (50 Min for Answers + 5 Min for Download doc, Mail Back)
Instructions:
A) (+2) correct answer and (-1) wrong answer.
B) For your better knowledge, dont mark options as fluke or dont take Google or any of
your friend help just think about the concept (hidden behind) yourself.
(BE HONEST TO YOURSELF ATLEAST, AS ITS EVERYTHING FOR YOU)
C) You have to mail me back Word document with answers only within time otherwise it
would not be evaluated.
D) Apply logical reasoning wherever you found possibility.

1)

char c=o;
printf ( %d %d , sizeof( c ) , strlen( o ) );
a) 1,1

2)
3)

4)

b) 2,2

c) 1,2

d) 2,1

e) None

printf( %d , - 9 << 2 );
a) 177734
b) 12345

c) 17734

d) Compilation Error

main()
{
int ab,bc,cd,de;
ab=3; bc=5;
cd=ab,bc;
de=( ab,bc );
printf( %d %d , cd , de );
}
a) 3,3
b) 5,3

c) 3,5

d) 5,5

main()
{
unsigned char i= 0x0008;
printf( %d , i << 1);
}
a) 0
b) 256

c)80

d) 100

5) int main()
{
union var
{
int a,b;
}v;
v.a=10;
v.b=20;
printf( %d , v.a);
}
a) 10

b) 20

6) int x,y,z;
y= ( x=1,y=2,z=3 );
printf( %d %d %d ,x,y,z);
a) 1 1 3
b) 1 2 3

c) 30

d) 0

c) 1 0 3

d) 1 3 3

7) How many bytes are occupied by near, far and huge pointers?
a) 2,2,4
b) 2,4,4
c) 2,4,2

d) 2,2,2

8) int x=134;
printf( %f , x );
a) 134.000000

d) Run time Error

b) 134

c) Compilation Error

9) Which of the following can be used to find the first occurrence of a given string in another?
a) strchr()
b) strrchr()
c) strstr()
d) strnset()

10) int a , x=5,y=10,z=15;


a= ( ++x && ++y,++x), ++x || ++z;
printf( %d %d %d %d , a,x,y,z);
a) Compilation Error
b) 6 7 10 15

11) float q=3.5;


double w=3.5;
q=3.5==q;
w=3.5==w;
printf( %d %d , q,w);
a) 1 1

b) 0 0

c) 6 8 11 14

c) 1 0

d) 7 8 11 15

d)

None

12) int a=576;


char *ptr=&a;
a) 320

printf( %d ,*ptr);
b) 64
c) 0

13) printf( 1 + cd );
a) Garbage

printf( 1 + am );
b) cdam

d) 1

c) %d%c

e) None

d) None(___)

14) int a=9;


if( a==9)
{
a = ~ a + 2 << 1 ;
printf( %d ,a );
}
else
break;
a) -5
b) -4

c) -6

d) ERROR : Compilation

e) None

15) char c= \08 ;


printf( %d,c );
a) 8

c) NULL

d) Compilation Error

e) 9

b) 8

16) #define call(x,y) x##y


main()
{
int x=5,y=10,xy=20;
printf( %d, xy + call(x,y) );
}
a) 40
b) 510
c) 530

d) 15

e) None

17) int d,c=91;


d= (a==91 ? return 9 : return 1);
printf( %d ,d );
a) 9
b) 1
c) 91

d) Run Time Error

e) None

18) auto int d=2;


main()
{
int d=9;
printf(%d,d);
}
a) 2
b) 11

c) 9

d) Compile Error

19) int *x=10,*y=20;


*x^= *y^=*x^= *y;
printf( %d %d , *x,*y);
a) Suspicious Pointer Conversion
c) Compilation Error

b) Linking Error
d) None Of these

20) char CU[]=chtkara;


char *p=chtkara;
printf(%d %d ,sizeof (CU),strlen(CU) );
printf(%d %d ,sizeof (p),strlen(p));
a) 7 7 7 7
b) 8 7 8 7

21) int a[5]={1,2,3,4,5};


printf(%d,a[-2]);
a) 2
b) -4

e) None

c) 2 7 2 7

c) Compilation Error

d) 8 7 2 7

d) -3

e) None

22) char str1[15]=Blue Shirt; int i=0;


for ( i=0; i<9;i++)
{
printf(%c, *str1++); }
Write Down Output ? ________________________________________________

23) sizeof ( NULL ) ?????

Answer : ______________________________________________

24) int i=j=3,a,b;


a=b=5;
for(i=1;i<=a&&j<=b;i++,j++) {
a) 3 to 5
b) 3 to 4

printf( %d %d ,i,j ); }
c) 4 to 5
d) ERROR

e) None

25) int a[5]={3},i;


for(i=0;i<5;i++) { printf(%d,a[i] ); }
a) 3 0 0 0
b) 3 3 3 3
c ) 3 garbage garbage garbage

26) char str[10] = Chitkara;


printf(%s,&str[0]);
a) C
b) Chitkara

c) No output

27) Write the Output if input is a=2,b=3...


Answer : _____________________________

28) #define x 4+1


main() { int i; i = x*x*x; printf("%d",i);

d) Compile Error

e) None

e) None

printf(Chitkara,scanf(%d %d,&a,&b));

return 0; }

(a) 125
(b) 13
(c) 17
(d) None of above

29) main() { int cin=5; printf("%d",cin); return 0; }


(a) 5
(b) 1
(c) 0
(d) Compilation error
(e) None of these

30) main(){ int i,j; i=j=2,3;


while(--i&&j++)
printf("%d %d",i,j);
}
(a) 2
(b) 3
(c) 13
(d)Infinite loop
(e) Compilation error

d) 0 0 0 0

Identify Output and Error if there the Following Questions :


31) main( ) { long int 1a=5l; printf("%ld",1a); }

Answer : ____________________

32) main( ) { int a=5,b=10,c=1;


if(a&&b>++c)
printf("%d%d%d",a,b,c);
}
Ans: _________________
33) main()
{
char c=125;
c=c+10;
printf("%d",c);
}

Answer : __________________________________________

34) char arr[11]="The Baker Queen";


printf("%s",arr);
Answer : __________________________________________
35) main(){
char p;
char buf[10] = {1, 2, 3, 4, 5, 6, 9, 8};
p = (buf + 1)[5];
printf("%d\n", p); }
Answer : __________________________________________
36) main() {
int a = 2;
if(a == (1,2))
printf("Hello");
if(a == 1,2)
printf("World");
}

Answer : _____________________________________________

37) #include <stdio.h>


#define crypt(s,t,u,m,p,e,d) m##s##u##t
#define begin crypt(a,n,i,m,a,t,e)
int begin()
printf("Hello\n");
Answer: _________________________________________

38) main()
{
int a[10][20][30]={0};
printf("%ld",&a+1 - &a);
return 0;
}

Answer : ______________________________________

39) int main()


{
int a;
printf("%d",scanf("%d",&a));
return 0;
}
Answer : ______________________________________________

40) syntax of fseek ________________________________________________

You might also like