Fault 静态错误 ,Failure 外部错误 ,Error 内部错误
问题答案
第一题
1.1 当数组x内的元素≥2时,该循环不会检测到x[0]这个元素。
1.2 test: x=[2, 3, 2]; y = 2 Expected = 2
1.3 test: x=[2, 3, 2]; y = 1 Expected = -1
1.4 test: x=[2, 3, 3]; y = 2 Expected = 0, but = -1
第二题
2.1 程序希望找到数组中最后一个出现的0,实际上找到的是数组中第一个出现的0。
2.2 test: x=[1] Expected = -1
2.3 test: x=[0,1] Expected = 0
2.4 test: x=[0, 1, 0] Expected = 2, but = 0