int[][] items = {{0, 1, 3, 4}, {4, 3, 8, 0, 7 },{3, 2}} ;
Which of the following statements replaces the 8 with 1?
Choices:-
Items[1][2] = 1;
Items[2][1] = 1;
Items[ 8 ] = 1;
Items[2][3] = 1;
Answers
Answered by
3
Answer:
items [1][2] = 1; replaces the 8 with 1.
Explanation:
- items[1][2] = 1; - Correct, as it refers to the 3rd element of the second SDA in items DDA.
- items[2][1] = 1; - Incorrect, as it refers to the 2rd element of the third SDA in items DDA.
- items[ 8 ] = 1; - Incorrect, as it a wrong assignment also 8 is out of range.
- items[2][3] = 1; - Incorrect, as it refers to the 4rd element of the third SDA in items DDA.
Arrays
They are collection of elements of homogenous type (of same data type) collected as a single unit.
Arrays be classified to mainly two types -
- Single Dimensional Array (SDA) and,
- Double Dimensional Array (DDA) also known as "Arrays of Arrays".
Similar questions
Biology,
1 month ago
Social Sciences,
1 month ago
English,
3 months ago
Social Sciences,
9 months ago
English,
9 months ago
Science,
9 months ago