Testing, Debugging & Code Optimization Flashcards
7 cards from real CPA practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Testing, Debugging & Code Optimization flashcards as text
What is 'integration testing'?
Answer: Testing how multiple modules or components work together
Integration testing verifies that separate modules interact correctly when combined, catching interface mismatches that unit tests may miss.
A function calls itself recursively without a base case. What type of error results?
Answer: Stack overflow (infinite recursion)
Without a base case, each recursive call adds a frame to the call stack until the stack's memory limit is exceeded, causing a stack overflow.
Which optimization stores the results of expensive function calls so identical inputs return the cached result?
Answer: Memoization
Memoization caches the output of a function for given inputs so repeated calls with the same arguments skip recomputation.
What does a 'linter' primarily do?
Answer: Analyzes code for stylistic issues, potential bugs, and standards violations
A linter statically analyzes source code to flag errors, style violations, and suspicious patterns without executing the program.
What is an 'off-by-one' error?
Answer: A loop or index that iterates one too many or too few times
An off-by-one error occurs when a loop boundary or array index is incorrect by exactly one, such as iterating up to `< n` versus `<= n`.
Which type of testing is performed by end-users or clients to determine if the system meets business requirements?
Answer: Acceptance testing
Acceptance testing (UAT) is conducted by end-users or clients to validate that the delivered software meets agreed-upon business requirements.
What does 'cyclomatic complexity' measure?
Answer: The number of independent paths through a program's source code
Cyclomatic complexity counts the number of linearly independent paths through code, with higher values indicating more complex and harder-to-test logic.