Home »» Placement Papers »» All Papers »» Caritor »» Placement Paper

Caritor Services India Private Limited Placement Paper (Technical-C)



Paper: Caritor Services India Private Limited Placement Paper (Technical-C)

 C QUESTIONS:

1.struct x
{
int I;
char s;
}
union
{
struct x,y;
double j
}z;
main()
{
printf("%d",sizeof (union z));


2.struct x
{
int I;
short int j;
char a;
char b;
}
struct y
}
main()
{
printf("%d%d",sizeof(structx),sizeof(structy));
}
ans
12 12
12 8
12 8
8 12

3.main()
{
int I=0;
}
declaration
definition

4.main()
{
int I=1234.567
printf("%d",I)
}

ans
1234
1235
1234.567
error

  5.main()
{
int *+j
int *I=6;
if(NULL!=&&NULL!=*I)
printf(" ");
}

  6.main()
{
int a[]={'1','2','3',0,'1','2','3'}
printf("%s",a);
ans
123
1230123
error

  7.main()
{
#define x 10
{
printf("%d",++x);
}
ans
compilation error
run time error
10
11

8.main()
{
char a[]=("ABCxyz");
printf("%d",sizeof(a));
ans
26
27
25

9.main()
{
char a[] ="abcxyz",
char *x;
p=a;
printf("%d",sizeof(*p));
p=p+10;
printf("%d",sizeof(a);
ans
26,26
26,16
16,26

  10.
main()
{
int x=1111;
printf("%d",x);
}
ans. 0

11.main()
{
int i=(int*)0x1000;
printf('%d",I);
ans
1000
compilation error
runtime error

12.
main(int I)
{
printf("%d",I)
}
ans
error

  13.main(int arg c)
int I,j=0;
{
for(I=0;I  
j=j+.(argv(I))
printf("%d",j);
}
ans
123
error
6

14.main()
{
printf("%d",printf("helloworld"));
}

ans 13
hello world
hello world 13
error

15.
main()
{
int a[2][2][6]
{{2,3,4,5,6,7}
{.}}
printf("%u%u%u%u",a,*a,**a,***a);

assume base address is 567895
ans . 567895, 567895, 567895,2

16.
main()
{
a[2][2]={{2},{3}}
printf("%d",a[0][0]);
printf("%d",a[0][1]);
printf("%d",a[1][0])
printf("%d",a[1][1]);
}
ans
2000
2300
2030
2003

Comment

0 Answers