There are two faulty programs. Answer the following questions about each program.
1.Identify the fault.
程序一:索引值i取不到0,数组中遗漏最后一个元素。
程序二:当搜索到第一个0时便返回其索引(并非最后一个0值)
2.If possible, identify a test case that does not execute the fault.
程序一:
Test: x = [], y = 2
程序二:
Test: x = []
3.If possible, identify a test case that executes the fault, but does not result in an error state.
程序一:
Test: x = [2, 3, 5], y = 2
程序二:
Test: x = [0, 1, 2]
4.If possible, identify a test case that results in an error, but not a failure.
程序一:
Test: x = [3, 4, 5], y = 2
程序二:
Test: x = [1, 2, 3]