Practice question · Select all that apply
Select every benefit the lesson attributes to writing an invariant checker.
Hints
- An invariant is a statement about correctness of state, not about time or about every other behaviour.
- Two options claim something a property check cannot possibly establish.
Show the answer
- A. It localises a bug to the operation that broke the structure
- C. It catches mis-linked pointers, unbalanced subtrees and mis-hashed keys
- E. It documents what the structure guarantees, in executable form
Why
Localisation, broad coverage of structural faults and executable documentation are all claimed. A checker says nothing about speed, and it verifies the structure's state rather than the results the program produces, so it complements other tests instead of replacing them.
Practise Debugging Structural Invariants
The app has 6 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.
More questions on Debugging Structural Invariants
- Order the steps of debugging a data structure with an invariant checker.
- An invariant checker is written, run during development, and deleted before release. What was gained, and…
- Sort each statement about a binary search tree by whether it is an invariant of the structure.
- An invariant checker is code that verifies a structure's rules and is never called in production. Why is…