Fault Error Failure
Software Fault : A static defect in the software
Software Error : An incorrect internal state that is the manifestation of some fault
Software Failure : External, incorrect behavior with respect to the requirements or other description of the expected behavior
Q1:
Fault1:循环条件中的i > 0使得遍历结束时i=1。
Fault2:循环条件中 int i = 0 从数组头开始遍历,使找到的是第一个0,而不是最后一个0。
Q2:
Testcase1:x = []; y = 2
Testcase2: x = [];
Q3:
Testcase1:x = [1, 2, 3]; y = 2
Testcase2: x = [];
Q4:
Testcase1:x = [2, 5, 3]; y = 2
Testcase2: x = [1, 2, 3];