Open in TheBrain

Practice Lab 11.20

Practice Lab 11.20 — Expanded Lab 11 Skills Check

Name: Date:

Instructions

Complete this full practice in Bash using safe, short tests. Record code, output, and a trace for every loop. Verify termination logic before running.

  1. Write the carryon=Y user-controlled while loop, including prompt/read in the body and final message. Test several responses.
  2. Write a while counter to 10 and an until counter to 25; compare behavior and trace first/last iterations.
  3. Create weekday guessing loop using date +%a; describe command substitution and locale/time variance.
  4. Compare print-before-update and update-before-print counter loops; state which boundaries are shown.
  5. Write a loop counting 0 to 20 by 2; explain initialization, condition, increment, output.
  6. Write countdown 100 to 0 and a multiply-by-three sequence to 243. Trace start/end and demonstrate termination.
  7. Create one additional safe sequence of your own; state start, target, step/update, condition, and predicted values before running.
  8. Explain how to debug nonprogress, off-by-one errors, and targets skipped by an update.

Reflection: What is your checklist for proving a loop will terminate?