Question 4
Consider the following code segment.
int[][] arr = {{1, 2, 3, 4},
{5, 6, 7, 8},
{9, 10, 11, 12}};
int sum = 0;
for (int[] x : arr)
{
for (int y = 0; y < x.length - 1; y++)
{
sum += x[y];
}
}
What is the value of sum as a result of executing the code segment?
A
36
B
54
C
63
D
68
E
78