int a[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
main()
{
int i;
for(i = 0; i < 3; i++)
printf("%d%d%d", a[i][2-i], *a[i], *(*(a+i)+i));
}
a) 3 1 1
5 4 5
7 7 9
b) 7 1 1
5 4 5
3 7 9
c) 3 1 1
5 4 7
7 7 9
d) 3 5 7
1 4 7
1 7 9
Showing posts with label array. Show all posts
Showing posts with label array. Show all posts
Monday, February 8, 2010
Sunday, January 10, 2010
How many bytes are allocated by the definition below?
char txt [20] = "Hello world!\0";
a) 11 bytes
b) 12 bytes
c) 13 bytes
d) 20 bytes
e) 21 bytes
a) 11 bytes
b) 12 bytes
c) 13 bytes
d) 20 bytes
e) 21 bytes
Tuesday, May 19, 2009
If the size of the array is less than the number of initializers then,
a. Extra values are being ignored
b. Generates an error message
c. Size of Array is increased
d. Size is neglected when values are given
b. Generates an error message
c. Size of Array is increased
d. Size is neglected when values are given
Thursday, March 19, 2009
‘C’ allows arrays of greater than two dimensions, who will determined this
a. Programmer
b. Compiler
c. Parameter
d. None of these
b. Compiler
c. Parameter
d. None of these
Thursday, February 19, 2009
A multidimensional array can be expressed in terms of
a. Array of pointers rather than as pointers to a group of contiguous array
b. Array without the group of contiguous array
c. Data type arrays
d. None of these
b. Array without the group of contiguous array
c. Data type arrays
d. None of these
Thursday, January 8, 2009
Find the correct output
void main()
{
int a[]={‘a’,’b’,’c’};
printf(“%d”, sizeof(a));
}
(a) 3
(b) 4
(c) can’t be initialized
(d) None of these
{
int a[]={‘a’,’b’,’c’};
printf(“%d”, sizeof(a));
}
(a) 3
(b) 4
(c) can’t be initialized
(d) None of these
Friday, December 5, 2008
What is the output of following programme ?
int main()
{
int a[5]={0,1,2,3,4,5};
unsigned int b = 0xffffffff;
a[b] = 30;
printf("%d\n", a[-1]);
a[-1] = 50;
printf("%d %d\n", a[-1],b);
}
a. Error
b. Garbage Garbage 1
c. 30 50 -1
d. -30 -50 1
e. None of the above
{
int a[5]={0,1,2,3,4,5};
unsigned int b = 0xffffffff;
a[b] = 30;
printf("%d\n", a[-1]);
a[-1] = 50;
printf("%d %d\n", a[-1],b);
}
a. Error
b. Garbage Garbage 1
c. 30 50 -1
d. -30 -50 1
e. None of the above
Tuesday, November 11, 2008
You want to declare a pointer to an array of 20 elements containing double values.
Which one of the following statements do you use to declare a pointer to an array of 20 elements containing double values?
Choice a : push(double *array, [20]);
Choice b : double **array[20];
Choice c : double (*array)[20];
Choice d : void pointer = *array[20];
Choice e : double array = *array[20];
Choice a : push(double *array, [20]);
Choice b : double **array[20];
Choice c : double (*array)[20];
Choice d : void pointer = *array[20];
Choice e : double array = *array[20];
Subscribe to:
Posts (Atom)