1 C Programming Arrays Download PDF
1 C Programming Arrays Download PDF
com
http://www.gkseries.com/computer-engineering/c-programming/arrays/c-programming-objective-questions-and-answers-on-arrays
1.
int warr[3][2][2]={1,2,3,4,5,6,7,8,9,10,11,12};
[A] 5
[B] 7
[C] 7
[D] 11
warr[0][0][0]=1
warr[0][0][1]=2
warr[0][1][0]=3
warr[0][1][1]=4
warr[1][0][0]=5
warr[1][0][1]=6
warr[1][1][0]=7
warr[1][1][1]=8
warr[2][0][0]=9
warr[2][0][1]=10
warr[0][1][0]=11
2.
int a[50];
int *pa;
pa=a;
To access the 6th element of the array which of the following is incorrect?
[A] *(a+5)
[B] a[5]
[C] pa[5]
[D] *(*pa+5)
3.
int a[10]={1,2,3,4,5,6,7,8,9,10};
*p=a;
printf("\n%d:%d", p[7], p[a[7]]);
[A] 7:7
[B] 7:8
[C] 8:9
[D] 8:8
The first element of the array i.e. a[0] is assigned by *p=a. Therefore a[0]=1. Then p[7]=8 and p[a[7]]=p[8]=9
Hence 8:9
4.
main()
{
int a[4]={1,5};
printf("%d",a[3]);
}
[A] 0
[C] 5
5.
int a[10];
[A] a++;
[B] a=a+1
[C] *a++
[D] *a[1]