Compound Assignment Operators FRQ Practice

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

Question 1 of 5

A harvest log starts with int baskets = 9;

(a) Write compound assignments that add 6 baskets, then triple the count, then subtract 4. (b) State the final value. (c) Show the equivalent simple assignment for the tripling step.

Question 2 of 5

A row counter is written in two ways:

int row = 18;
row--;
int copy = 18;
copy -= 1;

(a) State the values of row and copy after these statements. (b) Explain why standalone postfix decrement matches subtracting 1 with -= for a simple variable. (c) Note one form that is outside the AP CSA subset: prefix decrement such as --row.

Question 3 of 5

Trace this greenhouse code. Show the stored value after each numbered statement.

int drops = 20;
drops += 6;   // 1
drops /= 4;   // 2
drops %= 4;   // 3
drops *= 5;   // 4

Then explain why statement 2 does not store 6.5.

Question 4 of 5

A student compares two updates:

int rain = 9;
rain += rain;
int mist = 9;
mist = mist + mist;

(a) State the values of rain and mist. (b) Explain what it means that the left-hand side of rain += rain; is evaluated once. (c) For these simple int variables, state whether the two updates store the same result and why.

Question 5 of 5

A tank volume is stored in a double named liters.

(a) Write Java that starts liters at 12.0, then uses /= to cut the volume in half, then uses -= to remove 1.5 liters. (b) State the final value. (c) Explain why keeping liters as double matters for the /= step compared with an int variable.