A stockroom display stores two tray counts named L and R. Initially, L contains 14 and R contains 9. The algorithm below uses another storage location, H. Copying a value replaces the destination's previous value and leaves the source unchanged.
Complete the table with the values stored immediately after each copying instruction. Enter exact whole numbers; each count is measured in items.
Unlock full course notes by signing up
Check the stopping boundary
A test procedure starts with an integer counter. Before each repetition, it checks whether the counter is positive. If it is positive, the procedure subtracts 2 and checks again. Otherwise, it stops and reports the counter. Complete the table with the exact whole-number repetition count and the final counter value for each starting value.
Information changes roles between algorithms
A greenhouse uses two algorithms. The watering algorithm receives a soil moisture reading of 24% and produces the instruction Water. The record-keeping algorithm then receives that instruction and stores it in the daily log.
Complete each classification with input or output, considering the named algorithm separately.
The moisture reading is an ________ to the watering algorithm. The instruction Water is an ________ of the watering algorithm. That same instruction is an ________ to the record-keeping algorithm.
Does the repair satisfy the specification?
A procedure accepts any non-negative integer nnn and sets x=nx=nx=n. Before each repetition, it checks whether xxx is different from zero. If so, it subtracts 2 from xxx and checks again; otherwise, it stops and outputs xxx. The specification requires it to stop and output zero for every permitted input. Which statements are true? Select all that apply.