II-144 Programming Concepts
for(k=0;k<6;k++)
printf(" %d ", l[k]);
}
(a) 14 9 17 11 13 17
(b) 12 8 16 10 12 16
(c) 14 19 17 10 12 11
38. What is the output of the following program?
void main()
{
char a[]={'A','B','C','D','E','F'};
char b[]={'0','1','2','3','4','4'};
char c[6],k;
for(k=0;k<6;k++)
c[k]=a[k]+b[k];
clrscr();
for(k=0;k<6;k++)
printf(" %c ", c[k]);
}
(a) q s u w y z
(b) Q S U W Y Z
(c) K J L M N O
39. If starting address of array int arr[5] = {5,4,3,2,1}; is 1042 then value 1 is at location
(a) 1048
(b) 1050
(c) 1046
(d) Same as the array i.e. 1042
40. The valid 2D-array definition is
(a) int b[][2] = {{1},{3,4}};
(b) int b[2][2] = {1,2,3,4};
(c) int b[][2] = {1,2,3};
(d) All of these
41. The general syntax for any type of array is
(a) data_type variable_name[size];
(b) data_type variable_name[];
(c) data_type variable_name[][] = initialization;
(d) data_type variable_name[size][];
42. The correct syntax for integer array in C is
(a) int b[3]; a[0]=1;a[1]=2;a[2]=3;
(b) int b[] = {1,2,3};
M07_ITL-ESL4791_02_SE_C07.indd 144 12/22/2012 5:03:01 PM