Which of the following best describes the main purpose of unit testing in software development?
Think about testing small pieces of code separately before combining them.
Unit testing focuses on testing small, individual parts of the code (units) to make sure each part works as expected before integrating them.
Consider a function that adds two numbers. A test case checks if add(2, 3) returns 5. What is the result of this test case?
def add(a, b): return a + b result = add(2, 3) expected = 5 passed = (result == expected) print(passed)
Check if the function returns the expected sum.
The function correctly adds 2 and 3 to get 5, so the test passes and prints True.
Which type of testing is described by the following: Testing how different parts of a program work together after unit testing is done?
Think about testing combined parts rather than the whole system.
Integration testing checks how different units work together after they have been tested individually.
Which statement correctly compares manual testing and automated testing?
Consider which testing type uses scripts or programs to run tests.
Automated testing uses scripts to run tests repeatedly and consistently without needing a person to do it each time.
Why is regression testing important after fixing a bug in software?
Think about what might happen when you change one part of a program.
Regression testing ensures that fixing one bug does not accidentally break other parts of the software.