155k views
1 vote
When processing all the elements of row i of a two-dimensional array named grades using a for loop with variable j, what is the condition of the for loop? _________________ .

a. j < length

b. j < grades.length

c. j < = grades.length

d. j < grades [i].length

e. j < = grades [i].length

User Lunatix
by
5.3k points

1 Answer

4 votes

Answer:

D

Step-by-step explanation:

Two dimensional array contain both rows and columns. Each row represented one record and each column represent one filed in that record.

for ex: int grades[5][3];

here array grades contains 5 rows and in each row we have 3 columns

if we have grades[i][j] then " i " represents number of rows and j represents the number of columns in that row.

j<grades[i].length represents i=0 to 2[here no of columns are 3, array index starts from 0 to 2]

The Answer is D

User Ravi Roshan
by
5.6k points