Multiple Choice
For the questions below, consider the following representation of grid and the maze code from Chapter 11.
Grid:
1 1 1 1 1 1 0 0
0 0 1 0 0 1 0 0
0 0 1 0 0 1 1 0
0 0 1 1 0 0 1 0
0 0 0 1 1 0 0 0
0 0 0 0 1 1 1 1
Code:
public boolean traverse(int row, int column)
{
if (valid(row, column) )
{
boolean done = false;
grid[row][column] = TRIED;
if (row == grid.length - 1 && column == grid[0].length - 1)
done = True;
else
{
done = traverse(row + 1, column) ;
if (!done) done = traverse(row, column + 1) ;
if (!done) done = traverse(row - 1, column) ;
if (!done) done = traverse(row, column - 1) ;
}
if (done) grid[row][column] = PATH;
}
return done;
}
Assume valid returns True if row and column are >= 0 and <= the grid's row length or column length and the entry at this position = = 1. And assume TRIED = 3 and PATH = 7
-If traverse is first called with traverse(0, 0) ; what will the first recursive call of traverse be?
A) traverse(0, 0) ;
B) traverse(0, 1) ;
C) traverse(1, 0) ;
D) traverse(1, 1) ;
E) traverse(0, -1) ;
Correct Answer:

Verified
Correct Answer:
Verified
Q1: For the questions below, recall the Towers
Q3: For the questions below, refer to the
Q4: For the questions below, consider the following
Q6: For the questions below, assume that int[
Q7: The following method correctly multiplies two ints
Q8: Define the magnitude of a number as
Q10: For the questions below, refer to the
Q20: Rewrite the following iterative method as a
Q40: The recursive method to solve the Towers
Q50: The following two methods will both compute