Question: Consider the following code segment. int [ ] [ ] arr = { { 6 , 2 , 5 , 7 } , { 7

Consider the following code segment.
int[][] arr ={{6,2,5,7},
{7,6,1,2}};
for (int j =0; j < arr.length; j++)
{
for (int k =0; k < arr[0].length; k++)
{
if (arr[j][k]> j + k)
{
System.out.println("!");
}
}
}
How many times will "!" be printed when the code segment is executed?
Responses
0 times
0 times
2 times
2 times
4 times
4 times
6 times
6 times
8 times

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!