C Language - Arrays

You Are Here :: Home > C Language > Arrays - General Questions

 
37.

main(){
char a[100];
a[0]='a';a[1]]='b';a[2]='c';a[4]='d';
abc(a);
}
abc(char a[]){
a++;
printf("%c",*a);
a++;
printf("%c",*a);
}

A. bb B. cc
C. bc D. cd




38.

What will be output if you will compile and execute the following c code?

1
#include
2
int main(void)
3
{
4
int array[2][2][3]={0,1,2,3,4,5,6,7,8,9,10,11};
5
printf("%d",array[1][0][2]);
6
return 0;
7
}

A. 5 B. 6
C. 7 D. 8




39.

int DIM(int array[])
{
return sizeof(array)/sizeof(int );
}
main()
{
int arr[10];
printf("The dimension of the array is %d", DIM(arr));
}
}

A. 0 B. 1
C. 2 D. None of the above




40.

What will be output if you will compile and execute the following c code?

1
#include
2
int main(void)
3
{
4
int array[3]={5};
5
int i;
6
for(i=0;i<=2;i++)
7
printf("%d ",array[i]);
8
}

A. 5 garbage garbage B. 5 0 0
C. 5 null null D. Compiler error




41.

main()

{
static char names[5][20]={"pascal","ada","cobol","fortran","perl"};
int i;
char *t;
t=names[3];
names[3]=names[4];
names[4]=t;
for (i=0;i<=4;i++)
printf("%s",names[i]);
}

A. pascal B. ada
C. cobol D. Compiler error




42.

#include
main()
{
struct xx
{
int x=3;
char name[]="hello";
};
struct xx *s=malloc(sizeof(struct xx));
printf("%d",s->x);
printf("%s",s->name);
}

A. hello B. hello 3
C. hel D. Compiler Error




« previous

1

2

3

4

5

6

7

8

9

...

next »

 
 
 



© 2013 freshersindia.in ® | Copyrights | Terms & Conditions
   Designed by Freshers India
Catch Us on