Algorithms with Selection and Repetition FRQ Practice

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

Question 1 of 5

A student must fill one water bottle at a hallway fountain. The cap must be unscrewed before the bottle is held under the stream. If the bottle is already full, skip filling; otherwise fill until the water reaches the neck line. The cap must be screwed on after that decision, before the student walks away. (a) Write an ordered algorithm that meets these requirements. (b) Identify the selection. (c) Identify the repetition. Use everyday language; Java code is not required.

Question 2 of 5

Four lunch trays sit left to right: W, X, Y, Z. Follow these steps in order. (1) If the leftmost tray is W, move it to the far right; otherwise swap the two rightmost trays. (2) Repeat "move the leftmost tray to the far right" until the leftmost tray is Y. (a) Show the line after step 1. (b) Show each line produced while repeating step 2, and the final line. (c) Explain why doing step 2 before step 1 would be a different algorithm.

Question 3 of 5

A gardener waters one tomato plant. The algorithm must check whether the top 2 cm of soil is dry. If it is dry, add water until the soil is damp. If it is not dry, skip watering. Then record today's date on the plant tag; that recording must happen last. (a) Write the algorithm in everyday language. (b) Explain what would go wrong if the date were recorded before the soil check. (c) Name the true/false condition used in the selection.

Question 4 of 5

A copy-room algorithm is shown in the table. The counter starts at 0. The first copy is blank. The second copy has text.

Step Instruction
1 Place one sheet on the glass
2 If the counter shows 0, set it to 1; otherwise leave the counter
3 Press Copy and wait until the output tray contains a page
4 If the page is blank, replace the sheet and repeat from step 3 until the page is not blank

(a) State whether step 2 changes the counter, and to what value. (b) How many times is Copy pressed? (c) Identify which steps are selection and which include repetition. (d) Explain why step 1 must occur before step 3.

Question 5 of 5

A locker-room algorithm requires: open the locker; if a towel is already inside, skip placing a towel, otherwise place a folded towel; keep pushing the door until it latches; then leave. A student instead places a towel, then opens the locker, then pushes the door once even if it did not latch, then leaves. (a) Identify two requirement violations in the student's version. (b) Rewrite the student's actions as a correct algorithm that uses selection and repetition. (c) Explain why "push until it latches" is repetition, not a single action.