Fault Error Failure

Below are are two faulty programs. Each includes a test case that results in faulty programs.Answer the following questions (in the next slide) about each program. 

Answer:

Program1:

1i>0 所以i最小为1,循环不能遍历数组

2test case:x=[ ],y= 2

3test case:x=[0,1,2],y= 3

4test case:x=[0,1,2],y= 3

 

Program2:

1程序查找的是第一个0

2test case:x=[ ]

3test case:x=[0,1,2]

4test case:x=[1,2,3]

 

posted @ 2017-03-01 22:07  小大道  阅读(128)  评论(0编辑  收藏  举报