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
-Assume at some point in processing, grid's row 0 has become 3 3 3 1 1 1 0 0. Which direction will next be tried?
A) up
B) down
C) left
D) right
E) none, the recursion ends at this point
Correct Answer:

Verified
Correct Answer:
Verified
Q36: Write a recursive method called numSegments(int order)
Q44: A recursive method without a base case
Q47: The Koch snowflake has an infinitely long
Q52: The following method correctly adds two ints,
Q53: The following drawing is a line using
Q54: Why is the following method one which
Q56: What is wrong with the following recursive
Q59: Aside from writing recursive methods, another way
Q60: For the questions below, use the following
Q62: For the questions below, assume that int[