(a):可绘制出如下图所示的流程图
(b):对于测试用例t1=(n=3)和t2=(n=5),MAXPRIMES = 4时,t1不能检查出错误,而t2则会发生数组越界错。
(c):要使测试路径不通过while循环体,只要numPrimes = n,直接取n = 1为测试用例即可。
(d):节点覆盖:{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
边覆盖:{(1,2),(2,3),(2,12),(3,4),(4,5),(5,6),(5,9),(6,7),(7,5),(7,8),(8,2),
(9,10),(9,11),(10,11),(11,2),(12,13),(13,14),(14,13),(13,15)}
主路径覆盖:{(1,2,3,4,5,6,7,8),(,2,3,4,5,6,8,2),(1,2,12,13,15),(1,2,12,13,14,13,15),
(5,6,7,5),(2,3,4,5,9,10,11,2),(2,3,4,5,9,11,2)}