This question refers to the following method:
public static boolean isThere(String[][] mat, int row, int col, String symbol)
{
boolean yes;
int i, count = 0;
for (i = 0; i < SIZE; i++)
if (mat[i][col].equals(symbol))
count++;
yes = (count == SIZE);
count = 0;
for (i = 0; i < SIZE; i++)
if (mat[row][i].equals(symbol))
count++;
return (yes || count == SIZE);
}
Now consider this code segment:
public final int SIZE = 8;
String[][] mat = new String[SIZE][SIZE];
Which of the following conditions on a matrix mat of the type declared in the code segment will by itself guarantee that
isThere(mat, 2, 2, "$")
will have the value true when evaluated?
I The element in row 2 and column 2 is "$"
II All elements in both diagonals are "$"
III All elements in column 2 are "$"
(A) I only
(B) III only
(C) I and II only
(D) I and III only
(E) II and III only