Sign in

Libre University uses your GitHub account. Signing in is only needed to sit a final test, so the score is kept on your profile.

Debugging

1.[3p]

Put the steps of the debugging method in order.

  1. Cut the failing case down until only what is needed to fail remains

  2. Make the bug happen on demand, with a written input and expected output

  3. Make the observation and keep or discard the hypothesis

  4. State a hypothesis specific enough to predict an observation

Show the answer

b, a, d, c

2.[3p]

A bug lies somewhere in a 1000 line region. How many checks does binary search need, at most, to reach a single line?

CorrectNot quite: 10

3.[2p]

A test passed at a release 512 commits ago and fails now. How many builds does git bisect need in the worst case?

CorrectNot quite: 9

4.[3p]

Why is "something is wrong with the sorting" a useless hypothesis?

Correct
The answer is: It predicts no observation, so nothing you look at can confirm or kill it
The answer is: It predicts no observation, so nothing you look at can confirm or kill it
The answer is: It predicts no observation, so nothing you look at can confirm or kill it

5.[3p]

A bug appears only sometimes, on the same input. What does intermittency usually mean?

Correct
The answer is: The program depends on something other than its input: time, randomness, ordering, or state left over from a previous run
The answer is: The program depends on something other than its input: time, randomness, ordering, or state left over from a previous run
The answer is: The program depends on something other than its input: time, randomness, ordering, or state left over from a previous run

6.[2p]

Logging an object in a browser console logs a live reference, so expanding it later can show a state the object did not have when it was logged.

Correct
The answer is: True

7.[3p]

Which of these make a print statement more useful?

Select all that apply

Correct
Correct
Correct
The answer is: Printing `typeof` beside the value when the type is in question, Labelling the print so the line it came from is obvious, Printing at the boundaries between functions

8.[3p]

Where should an assertion be placed while hunting a bug?

Correct
The answer is: On the invariant that would have to break for the bug to occur
The answer is: On the invariant that would have to break for the bug to occur
The answer is: On the invariant that would have to break for the bug to occur

9.[2p]

Before git bisect can be trusted, one thing must exist: a single command that answers good or bad reliably. What is that called, in one word?

CorrectNot quite: reproduction