Introduction to Algorithms, Programming, and Compilers FRQ Practice

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

Question 1 of 5

A stage crew must prepare one music stand. A score booklet and a pencil must both be placed on the stand before a clip is attached to hold them. The clip must be attached before the stand is rolled onto the stage. (a) Write a valid ordered algorithm. (b) Explain what is wrong with the sequence "attach clip, roll stand, place booklet, place pencil." (c) Identify one pair of steps that can be swapped without breaking the requirements.

Question 2 of 5

A baker starts with 12 muffins. Follow the numbered steps in the table exactly once, in order. (a) Give the muffin count after every step. (b) Give the final count. (c) If steps 1 and 2 were exchanged, what final count would result? Show enough work to justify your answer.

Step Action
1 Set aside 4 muffins for a tasting tray
2 Double the muffins that remain
3 Add 2 muffins from a backup pan
4 Give away 6 muffins

Question 3 of 5

A robotics club keeps a Java source file on a shared drive. Friday's compiled program still sits on a lab computer. Over the weekend a student edits the shared source to change a sensor-check message. (a) If someone runs Friday's compiled program on Monday morning, what output should they expect, and why? (b) List the steps required to run a program that includes the weekend edit. (c) Explain one reason an IDE is convenient for this workflow and one reason it is not required.

Question 4 of 5

After writing a leftover-seat calculator for a field trip of 40 available seats, a student points at the compiler's success message and says the assignment is finished. (a) State what this message establishes. (b) State one important property it does not establish. (c) Describe a concrete next step for checking the program's intended behavior. Include one planned input and the leftover count you would expect if the algorithm is correct.

Question 5 of 5

A student is reviewing three separate programs. For each part, identify the error type (syntax error, logic error, or run-time error) and justify the classification. (a) Program 1: the compiler reports a missing required closing parenthesis, and compilation fails. (b) Program 2: the program compiles and finishes. It was intended to compute leftover seats as 40 minus the number reserved, but it computes 40 plus the number reserved. (c) Program 3: the program compiles, then an unhandled exception stops it while it tries to read a missing rehearsal-schedule file.

int reserved = 7;
int leftover = 40 + reserved;
System.out.println(leftover);