Assignment Statements and Input FRQ Practice

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

Question 1 of 5

Trace the assignments. State the final value of points, explain each stored result in order, and write one System.out.print statement that displays points.

int points = 6;
points = points * 3;
points = points - 4;

Question 2 of 5

Two int variables hold contest scores: red is 21 and blue is 35. Write statements that swap their values using one extra int named hold. State the final values of red and blue, and explain why hold is needed.

Question 3 of 5

Trace the references. State the final values of tag and copy, explain what each assignment stores, and explain why copy is not cleared when tag is assigned null.

String tag = "C12";
String copy = tag;
tag = null;

Question 4 of 5

Contract: Input.readInt() reads the next integer the user types and returns it as int. Each call consumes one integer. Write statements that store that result in an int named weeks, then store weeks * 7 in an int named days. If the user types 3, give the value of days. Identify which statement receives input.

Question 5 of 5

Contract: Input.readDouble() reads the next decimal number the user types and returns it as double. Each call consumes one number. The user types 2.5, then 1.5. Write statements that store those values in rate and hours, then store rate * hours in pay. State the value of pay and explain why two helper calls are required.