QUESTION 28
Consider the following statement:
int alpha[25][10];.
Which of the following statements about alpha is true?
1. Rows of alpha are numbered 0...24 and columns are numbered 0...9.
2. Rows of alpha are numbered 0...24 and columns are numbered 1...10.
3. Rows of alpha are numbered 1...24 and columns are numbered 0...9.
4. Rows of alpha are numbered 1...25 and columns are numbered 1...10.
QUESTION 29
Which of the following correctly declares and initializes alpha to be an array of four rows and three columns with the
element type int?
1. int alpha[4][3] = {{0,1,2} {1,2,3} {2,3,4} {3,4,5}};
2. int alpha[4][3] = {0,1,2; 1,2,3; 2,3,4; 3,4,5};
3. int alpha[4][3] = {0,1,2:1,2,3:2,3,4:3,4,5};
4. int alpha[4][3] = {{0,1,2}, {1,2,3}, {2,3,4}, {3,4,5}};
QUESTION 28
The true statement is:
1. Rows of alpha are numbered 0...24 and columns are numbered 0...9.
This is because the indices of an array starts from 0 to n-1. Hence row will be 0 to 24 and column 0 to 9.
QUESTION 29
The correct statement is :
4. int alpha[4][3] = {{0,1,2}, {1,2,3}, {2,3,4}, {3,4,5}};
Comments
Leave a comment