C is a common Programming language which is used for software development especially for system software. Objective from C programming language are generally asked in every written test related to computer job.In this post ,I am presenting some objective questions from C Programming.Try to attempt these related to computer job. objective Questions from C Programming
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[]=(“ABC……………xyz”);
printf(“%d”,sizeof(a));
ans
26
27
25
9.main()
{
char a[] =”abc………………xyz”,
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
12
13.main(int arg c)
int I,j=0;
{
for(I=0;I<argc:I++0)
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
Related