Free Online Flashcard Deck

8 Testing, Debugging, and Algorithmic Efficiency Free Online FlashCards

Study 8 Testing, Debugging, and Algorithmic Efficiency with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.

12 cards
01
Front

What does a complete test case specify?

Back

A test case specifies the input, preconditions, expected result, observed result, and whether the test passed or failed.

02
Front

What is boundary-value testing?

Back

Boundary-value testing examines values at, just below, and just above important limits to expose errors in comparisons, loop bounds, and indexing.

03
Front

What is an edge case?

Back

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.

04
Front

How should a robust program handle invalid input?

Back

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.

05
Front

How do testing and debugging differ?

Back

Testing reveals that behavior is wrong; debugging investigates the cause of the failure and corrects it.

06
Front

What is a regression test?

Back

A regression test is preserved after a bug fix so that the test fails if the same defect returns.

07
Front

What is a loop invariant?

Back

A loop invariant is a property that remains true before and after every loop iteration.

08
Front

When is an algorithm correct?

Back

An algorithm is correct if it produces the required result for every input satisfying its stated conditions and terminates as required.

09
Front

What is the usual complexity of two full nested loops?

Back

Two nested loops that each process all items often require O(n2)O(n^2) time because the work can grow proportionally to the square of the input size.

10
Front

What are binary search's key precondition and time complexity?

Back

Binary search requires sorted data and repeatedly halves the remaining search space, giving it O(log⁡n)O(\log n) time.

11
Front

What trade-off does the set-based duplicate check make?

Back

The set-based duplicate check usually runs in O(n)O(n) time and uses O(n)O(n) additional memory, trading space for faster lookup.

12
Front

What should useful code comments explain?

Back

Comments should explain why a non-obvious decision is necessary, rather than merely restating what the code does.