Essay
Assertions
For each of the five points labeled by comments, identify each of the assertions in the table below as either being always true, never true, or sometimes true / sometimes false.
public static int randomWalk(int steps) {
Random rand = new Random();
int x = 0;
int r = rand.nextInt(2);
// Point A
while (steps > 0 || x == 0) {
// Point B
if (r == 0) {
x++;
// Point C
} else {
x = 0;
// Point D
}
steps--;
r = rand.nextInt(2);
}
// Point E
return x;
}
Fill in each box below with one of ALWAYS, NEVER or SOMETIMES. (You may abbreviate them as A, N, or S.)
Correct Answer:

Verified
Correct Answer:
Verified
Q1: While Loop Simulation<br>For each call below
Q2: Expressions<br>For each expression in the left-hand
Q4: Parameter Mystery<br>At the bottom of the page,
Q5: If/Else Simulation<br>For each call below to
Q6: Programming<br>Write a static method named containsBothDigits
Q7: Programming<br>Write a static method hopscotch that shows