ARRAY
Find out the output of the following Programs
SLNO QUESTIONS SLNO QUESTIONS
1 main() 2 main()
{ {
char x[]=”India is the int a[5]={1,3,6,7,0};
best”; int *b;
char y[25]; b=&a[2];
char *p=x; printf(“%d”,b[-1]);
char *q=y; }
while(*p)
{
*q=*p;
p++;
q++;
}
printf(“%s”,y);
}
3 void main() 4 void main()
{ {
char *p=”abc”; int arr[]={1,2,3,4,5};
char *q=”abc123"; int str[]={1,2,3,4,5};
while(*p++=*q++) char *p=str;
printf(“%c %c”,*p,*q); *++p=1;
} printf(“%d”,arr[*(str+2)-
*p]);
}
5 void main() 6 void main()
{ {
char a[4]="rama"; static int a[]={1,2,3,4,5};
char b[]="shyama"; int i;
printf("%d %d",sizeof(a),sizeof(b)); for(i=0;i<5;i++)
{
} *(a+i)=a[i]+i[a];
printf("%d",*(i+a));
a. 4 7 }
b. 5 6 }
c. 5 7 a. 2 4 6 8 10
d. 4 6 b. 1 3 5 7 9
c. Expression syntax error
d. None of these
7 void main() 8 Which of the following format for a[3]+1
{
int a. *(a+3)+1
a[2][2][3]={{1,2,3,6,7,8},{5,7,9,3,4,1}}; b. *(a+4)
printf("%d",*(*(*(a+1)+1)+1)); c. (*a+3)+1
} d. *(a[3]+1)
a. 5
b. 3
c. 4
d. 6