Free Online Flashcard Deck

10. Integrated Problem-Solving Practice Free Online FlashCards

Study 10. Integrated Problem-Solving Practice with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.

12 cards
01
Front

What cycle should guide an integrated programming problem?

Back

First understand requirements, represent the data, design the algorithm, implement in small parts, test cases, debug systematically, and evaluate correctness and efficiency.

02
Front

What is an algorithmic invariant?

Back

An invariant is a statement that must remain true at a particular point in an algorithm, such as all items outside a search range being ruled out.

03
Front

What does classify_number return for zero?

Back

It returns "positive" when value > 0, "negative" when value < 0, and "zero" otherwise.

04
Front

How does summarize_scores handle an empty list?

Back

It returns 0, 0, None, avoiding division by zero and making empty-input behavior explicit.

05
Front

What makes a password valid in the example?

Back

Both conditions must be true: the password has at least eight characters and contains at least one digit.

06
Front

Why does condition order matter in temperature_counts?

Back

The order determines classification: elif is checked only if the preceding condition is false, so explicit boundaries prevent overlap or gaps.

07
Front

What data structure suits a frequency table?

Back

A mapping from each item to its count, because it directly represents the relationship and avoids parallel lists.

08
Front

What defect is in the incorrect average function?

Back

The denominator incorrectly uses len(value), where value is the last element. It should use len(values), with an empty-list check first.

09
Front

How do you prevent a nonterminating search loop?

Back

The loop must change a controlling variable or condition toward termination; in find_first_even, index += 1 is required when the value is odd.

10
Front

What precondition does binary search require?

Back

Binary search requires data sorted according to the same ordering used by its comparisons; otherwise, discarding half the range is unjustified.

11
Front

What is linear search’s worst-case time complexity?

Back

Linear search has worst-case time complexity O(n), because it may examine every element before finding the target or reaching the end.

12
Front

Why is binary search O(log n)?

Back

Binary search has worst-case time complexity O(log n), because each iteration reduces the remaining search range by about half.