Nested Iteration FRQ Practice

Responses receive AI feedback against a rubric after submission. Scores are practice estimates.

Question 1 of 5

A banner club runs this nested loop:

for (int row = 1; row <= 2; row++) {
    for (int col = 1; col <= 3; col++) {
        System.out.print(row);
        System.out.print(col);
        System.out.print(" ");
    }
}

(a) List the (row, col) pairs in the order the inner body runs. (b) Write the exact text printed, including spaces. (c) Explain why the pair (2, 1) cannot print before (1, 3).

Question 2 of 5

Complete the missing cells for this nested loop. Then explain when println runs relative to the inner loop.

for (int i = 1; i <= 3; i++) {
    for (int j = 1; j <= 2; j++) {
        System.out.print("*");
    }
    System.out.println();
}
Outer i Number of inner iterations Text printed before println
1
2
3

Question 3 of 5

A clerk traces this off-by-one pair of bounds:

int count = 0;
for (int x = 0; x < 3; x++) {
    for (int y = 0; y < 3; y++) {
        count++;
    }
}

(a) State the final value of count. (b) State the new final value if the inner condition is changed to y <= 3. (c) Explain the extra inner iterations using the idea that the inner loop finishes on every outer pass.

Question 4 of 5

A poster printer needs this exact pattern, with a newline after each row:

1
22
333

(a) Write nested for loops that produce that pattern using System.out.print and System.out.println. (b) State how many times print is executed for a digit. (c) Explain how the inner loop bound uses the outer loop variable.

Question 5 of 5

A signal tower uses nested while loops:

int outer = 3;
while (outer > 0) {
    int inner = outer;
    while (inner > 0) {
        System.out.print("*");
        inner--;
    }
    System.out.println();
    outer--;
}

(a) Write the three lines of output. (b) State how many times print("*") runs. (c) Explain why inner must be assigned from the current outer value at the start of each outer pass. (d) State what the first row would print if inner were declared once before the outer loop and never reset.