What does a complete test case specify?
A test case specifies the input, preconditions, expected result, observed result, and whether the test passed or failed.
Study 8 Testing, Debugging, and Algorithmic Efficiency with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What does a complete test case specify?
A test case specifies the input, preconditions, expected result, observed result, and whether the test passed or failed.
What is boundary-value testing?
Boundary-value testing examines values at, just below, and just above important limits to expose errors in comparisons, loop bounds, and indexing.
What is an edge case?
An edge case is an unusual but valid or relevant situation that may reveal hidden assumptions, such as an empty list, duplicate values, or reverse-sorted data.
How should a robust program handle invalid input?
The program should detect the invalid input and respond as specified, such as by showing an error, returning an error value, raising an exception, or requesting new input.
How do testing and debugging differ?
Testing reveals that behavior is wrong; debugging investigates the cause of the failure and corrects it.
What is a regression test?
A regression test is preserved after a bug fix so that the test fails if the same defect returns.
What is a loop invariant?
A loop invariant is a property that remains true before and after every loop iteration.
When is an algorithm correct?
An algorithm is correct if it produces the required result for every input satisfying its stated conditions and terminates as required.
What is the usual complexity of two full nested loops?
Two nested loops that each process all items often require O(n2) time because the work can grow proportionally to the square of the input size.
What are binary search's key precondition and time complexity?
Binary search requires sorted data and repeatedly halves the remaining search space, giving it O(logn) time.
What trade-off does the set-based duplicate check make?
The set-based duplicate check usually runs in O(n) time and uses O(n) additional memory, trading space for faster lookup.
What should useful code comments explain?
Comments should explain why a non-obvious decision is necessary, rather than merely restating what the code does.