Questions: Testing and Validation Basics

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

A function `is_palindrome(s)` is tested with `assert is_palindrome('racecar') == True` and `assert is_palindrome('hello') == False`. Both tests pass. Which statement is most accurate?

AThe function is correct — it handles the typical cases
BThe tests are sufficient — one positive and one negative case is standard practice
CThe tests are incomplete — they don't verify behavior on edge cases like empty strings, single characters, or strings with spaces
DThe function is correct for all inputs since both assertions check true and false cases
Question 2 Multiple Choice

A developer is told 'comprehensive testing slows down development.' Which response best reflects the insight from this topic?

ATrue — testing is valuable long-term but undeniably adds time in the short run
BFalse — well-designed tests make development faster by catching bugs at the moment of creation rather than in debugging sessions later
CTrue — testing should be reserved for production-ready code, not used during active development
DFalse — tests run automatically and add no time cost at all
Question 3 True / False

If most tests in a test suite pass, the program is correct.

TTrue
FFalse
Question 4 True / False

Writing tests before writing the implementation (test-driven development) can improve code quality because knowing you need to test a function encourages you to design it with cleaner inputs and outputs.

TTrue
FFalse
Question 5 Short Answer

Why should test cases include edge cases and error cases in addition to normal cases, and where are bugs most commonly found?

Think about your answer, then reveal below.