12.3 Program Testing and Maintenance (3)

Resources | Revision Questions | Computer Science

Login to see all questions

Click on a question to view the answer

1.

A programmer is debugging a Python program that calculates the factorial of a non-negative integer. The program is intended to use recursion. However, the program consistently produces incorrect results for inputs greater than 5. Identify at least three different types of errors that could be present in the code and explain how each type of error manifests in this scenario. For each error type, suggest a method for detecting it during the development process.

2.

Consider a program that reads data from a file. Explain how the use of input validation can help avoid faults. Provide a specific example of an invalid input and describe how input validation would prevent a fault.

3.

Explain the difference between a test strategy and a test plan. Provide an example to illustrate how they are related.