Algorithms with Selection and Repetition MCQ Practice

Question 1 of 10

A student is describing how to pack one field-trip first-aid pouch. Which description is the clearest algorithm that includes a true/false decision?

  1. A. Pack the pouch correctly.
  2. B. Include whatever supplies seem useful.
  3. C. If antiseptic wipes remain in the box, pack three wipes; otherwise pack a note that wipes are out, then pack a roll of tape.
  4. D. Take care of first aid as needed.

Question 2 of 10

A rider waits at a shuttle stop until the shuttle arrives, then boards if a seat is open; otherwise the rider stays and waits for the next shuttle, repeating until boarding succeeds. Which statement is true?

  1. A. Waiting until a shuttle arrives is repetition; checking whether a seat is open is selection.
  2. B. Boarding is selection because it happens at a bus stop.
  3. C. The algorithm contains sequencing only, because the rider always boards the first shuttle.
  4. D. Checking for an open seat is repetition because it is the last decision.

Question 3 of 10

A chemistry student is dissolving a solid in a flask. Which description uses repetition until an outcome?

  1. A. Label the flask with the compound name.
  2. B. Light the hot plate.
  3. C. Pour 50 mL of water into the flask once.
  4. D. Swirl the flask, check whether the solid has disappeared, and swirl again if it has not, continuing until none remains.

Question 4 of 10

A greenhouse vent starts closed. The thermometer first reads 32, and after the wait it reads 27. Follow the table. Which statement is true?

Step Instruction
1 Read the thermometer
2 If the temperature is greater than 30, open the vent; otherwise leave it closed
3 Wait until the temperature is at most 28
4 If the vent is open, close it; otherwise leave it
  1. A. The vent stays closed the whole time.
  2. B. The vent is opened after the first reading, then closed after the wait.
  3. C. Step 2 is repetition because temperature can change.
  4. D. The wait happens before the thermometer is read.

Question 5 of 10

Four cups sit left to right: P, Q, R, S. Follow these steps in order. (1) If the rightmost cup is S, swap the leftmost cup with the rightmost cup; otherwise leave the line unchanged. (2) Repeat "move the rightmost cup to the far left" until the leftmost cup is R. What is the final order?

  1. A. S, Q, R, P.
  2. B. P, S, Q, R.
  3. C. R, P, S, Q.
  4. D. R, S, Q, P.

Question 6 of 10

A cake must cool completely before icing is spread, or the icing will melt. Procedure R cools the cake, then spreads icing, then adds sprinkles. Procedure S spreads icing, then cools the cake, then adds sprinkles. Which statement is correct?

  1. A. R and S are equivalent because both end with sprinkles.
  2. B. S is better because icing happens sooner.
  3. C. Order never matters once the ingredients are listed.
  4. D. R follows the required order; S spreads icing while the cake is still warm.

Question 7 of 10

A classroom printer algorithm is: if the tray is empty, load one ream and check the tray again, repeating until the tray is not empty; then press Print. The tray is empty on the first two checks and loaded on the third check. How many times is a ream loaded?

  1. A. 0
  2. B. 1
  3. C. 2
  4. D. 3

Question 8 of 10

Which change would make a lab-cleanup algorithm harder for another student to follow reliably?

  1. A. Keeping "rinse the beaker until no soap bubbles remain" as the stopping rule
  2. B. Replacing "if the gas valve is open, close it; otherwise leave it" with "deal with the gas if needed"
  3. C. Listing rinse, dry, and store in that required order
  4. D. Stating both outcomes of the gas-valve check

Question 9 of 10

A theater crew follows this algorithm: (1) If the house lights are on, dim them; otherwise leave them. (2) Repeat "raise the curtain 10 cm" until the curtain is fully open. (3) Start the opening music. The house lights start off. The curtain starts 20 cm from fully open. Which statement is true?

  1. A. Step 1 dims the lights because every show begins in the dark.
  2. B. Step 2 is selection only, because the curtain is either open or not.
  3. C. Step 1 leaves the lights unchanged; the curtain is raised twice; music starts last.
  4. D. The music can start before the curtain moves without changing the result.

Question 10 of 10

An office clerk follows these instructions: "If the visitor badge is expired, reprint it; otherwise keep the current badge. Stamp the badge until the ink is clearly visible. Then file the badge." Which pair correctly names the constructs?

  1. A. Filing is selection; reprinting is repetition.
  2. B. The algorithm has sequencing only, because filing is last.
  3. C. Every sentence is repetition because office work can happen more than once.
  4. D. The expired-badge check is selection; stamping until the ink is visible is repetition; filing last is sequencing.