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 the key difference between a 'warning' and an 'error' in most compilers?
Answer: Errors prevent compilation; warnings indicate potential problems but still allow compilation
Compiler errors halt the build process because the code cannot be translated, while warnings indicate risky or non-standard code that compiles but may cause bugs.
Which testing strategy tests the system from the end-user's perspective without knowledge of internal implementation?
Answer: Black-box testing
Black-box testing treats the system as an opaque box, focusing only on inputs and expected outputs without knowing or caring about internal code structure.
What is 'tail-call optimization' (TCO)?
Answer: Reusing the current stack frame for a recursive call that is the last action in a function
TCO allows a compiler to reuse the current stack frame when a recursive call is the very last operation, preventing stack overflow in deeply recursive functions.
A developer notices the same test setup code duplicated across 20 test cases. What is the best fix?
Answer: Extract the setup into a shared setUp/beforeEach method or fixture
Using a setUp or beforeEach hook centralizes shared initialization logic, reducing duplication while still running the setup fresh before each test.
Which approach to bug tracking logs the exact steps required to consistently reproduce a bug?
Answer: Reproduction steps
Reproduction steps document the precise sequence of actions needed to trigger a bug, making it possible for others to confirm and fix the issue.
What is the primary benefit of 'continuous integration' (CI) for testing?
Answer: It automatically runs tests on every code commit to catch failures early
CI systems trigger automated test suites on every commit, ensuring that integration or regression bugs are discovered quickly rather than accumulating.
When optimizing an algorithm, which step should come first?
Answer: Profile the code to identify the actual bottleneck
Profiling first identifies exactly where time or memory is consumed, preventing wasted effort optimizing code that is not actually the bottleneck.