Question 400
In a repository maintenance task, the following condition is confirmed: A code rewrite lowers CPU but increases remote API calls. Which recommendation correctly handles the situation?
Explanation
Correct Answer
The choice "Evaluate end-to-end resource cost and latency" matches the requirement: A code rewrite lowers CPU but increases remote API calls. Local computational savings may create downstream expenses. This is the best-supported approach under the stated constraint.
Incorrect Answers
The alternative "Measure hit rate and define cache invalidation before release" fits another situation: Copilot recommends caching database lookups to reduce latency. Caching can introduce stale data and hidden correctness costs. Here the condition is A code rewrite lowers CPU but increases remote API calls; use "Evaluate end-to-end resource cost and latency" instead. Local computational savings may create downstream expenses.
The alternative "Verify ordering and rate limits under concurrent execution" addresses A model suggests parallel calls for a previously sequential process. Throughput gains can conflict with dependencies and quotas. It does not resolve A code rewrite lowers CPU but increases remote API calls; the correct choice is "Evaluate end-to-end resource cost and latency". Local computational savings may create downstream expenses.
For the different scenario An optimization swaps a stable sorting algorithm for an unstable one, "Preserve tie-order requirements and test exact ordering" could be appropriate. Algorithm changes can violate business-visible invariants. The present requirement is A code rewrite lowers CPU but increases remote API calls, which calls for "Evaluate end-to-end resource cost and latency". Local computational savings may create downstream expenses.