Documentation with Comments FRQ Practice

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

Question 1 of 5

Name the three Java comment forms and give one purpose for each.

(a) // (b) /* */ (c) /** */

Question 2 of 5

A mixer program currently contains:

int speed = 2;
speed *= 3;
System.out.print(speed);

(a) Show how to comment out only the speed *= 3; line using // so the printed value becomes 2. (b) Explain why the comment is not displayed. (c) Explain one reason a programmer comments out code during testing.

Question 3 of 5

Trace this bakery code and state the displayed text.

int eggs = 6;
/* eggs -= 2;
eggs += 5; */
eggs += 1;
System.out.print(eggs);

Then explain how a block comment differs from a // comment that appears on the eggs += 1; line.

Question 4 of 5

A student writes this header above a method:

/**
 * Returns the number of cooled loaves on the rack.
 */

(a) Identify the comment form. (b) Explain its intended audience and purpose. (c) Explain whether this comment assigns any variable by itself.

Question 5 of 5

A classmate claims any text that looks like Java inside a comment still runs.

int oven = 1;
// oven += 4;
oven += 2;
System.out.print("/* hot */");

(a) State the value of oven after this code. (b) State the displayed text. (c) Correct the classmate using both the line comment and the string literal.