A test that passed on commit 0 fails on commit 300. The commits are numbered 1 to 300 in order, every commit builds, the test gives the same result every time it runs on a given commit, and once a commit fails, every later commit also fails. You want the first failing commit.
You use this bisection rule. Let lo be the last commit known to pass and hi the first commit known to fail, starting with lo = 0 and hi = 300. Test commit m=⌊(lo+hi)/2⌋m = \lfloor (lo + hi)/2 \rfloorm=⌊(lo+hi)/2⌋; if it passes, set lo = m, and if it fails, set hi = m. Stop when hi = lo + 1; then hi is the first failing commit.
The first four tests give: fail, pass, pass, fail.
Give each answer as a whole number:
Unlock full course notes by signing up
Count conditional breakpoint pauses
A museum counts visitors arriving in six groups using the Python code below. A conditional breakpoint pauses execution only when its condition is true.
The breakpoint is attached to total += group, with condition total >= 30. The debugger checks the condition immediately before executing that line on every iteration. You continue execution after every pause without changing any values. How many breakpoint pauses occur during this run? Answer as an exact integer number of pauses, to zero decimal places.
Order a controlled repair
A student investigates an incorrect library loan fee. The calculation contains one suspicious update, but its inputs and output have not yet been inspected. Arrange the following actions into a coherent investigation, making one source-code change only after observing evidence for it.
Name the hypothesis and the safeguard
A student's sorting function returns a list in which one value appears twice and another value is missing. Before editing anything, the student writes: "The swap overwrites a[j] before saving it, so if I print the list right after the first swap I will see two copies of the same value." A testable explanation like this, written down together with the observation it predicts, is called a ________.
After fixing the swap with a temporary variable, the student saves the original failing list and its expected sorted output as an automated test that runs on every future change, so the same bug cannot quietly return. A test kept for this purpose is called a ________ test.
Separate localization from proof
A checkout program loads item prices, sums their values in cents, and formats the total as a money string. For one recorded run, the intended prices are 160, 240, and 350 cents.
Immediately after loading, the recorded list is [160, 240, 350]. The recorded total immediately after summation is 750 cents, and the formatter receives that same value. Its output is 7.05; the required output is 7.50.
Which statements are justified by this evidence? Select all that apply.