Question
The output below is generated by this program segment 10 10 11 13 16 20 21 23 26 30 35 37 40 44 49 55
The output below is generated by this program segment
10 10 11 13 16
20 21 23 26 30
35 37 40 44 49
55 58 62 67 73
int twoD[][] = new int[4][5];
int i, j, k = 10;
for(i = 0; i < 4; i++)
for(j = 0; j < 5; j++) {
twoD[i][j] = k;
k += i + j;
}
for(i = 0; i < 4; i++) {
for(j = 0; j < 5; j++)
System.out.print(twoD[i][j] + " ");
System.out.println();
}
Given this program segment and its output, list the values of the multi - dimensional array elements and their expressions that are shown. Use the array values that were generated after the program segment was executed. If a value or expression is undefined ( out of bounds ) , indicate this as such.
Enter your responses in the spaces provided.
_____ (a) twoD[3][1]
_____ (b) twoD[1][3]
_____ (c) twoD[2][2]
_____ (d) twoD[0][4]
_____ (e) twoD[2][1] - twoD[1][2]
_____ (f) twoD[1][3] - twoD[1][2]
_____ (g) twoD[3][4] + twoD[4][3] - twoD[3][0]
_____ (h) twoD[2][3] + twoD[1][3] * twoD[2][1]
_____ (i) twoD[3][4] * 3
_____ (j) twoD[4][3] * 2
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started