【Java程序】
public int addAppTask(Acitivity activity,Intent intent,
TaskDescription description,Bitmap thumbnail){
Point size=getSize(); //1
final int tw=thumbnail.getWidth();
final int th=thumbmail.getHeight();
if(tw!=size.x||th!=size.y){ //2,3
Bitmap bm=Bitmap.createBitmap(size.x,size.y,thumbmail.getConfig()); //4
float scale;
float dx=0,dy=0;
if(tw*size.x>size.y*th){ //5
scale=(float)size.x/(float)th; //6
dx=(size.y-tw*scale)*0.5f;
}else{ //7
scale=(float)size.y/(float)tw;
dy=(size.x-th*scale)*0.5f;
}
Matrix matrix=new Matrix();
matrix.setScale(scale, scale);
matrix.postTranslate((int)(dx+0.5f),0);
Canvas canvas=new Canvas(bm);
canvas.drawBitmap(thumbmail,matrix,null);
canvase.serBitmap(null);
thumbnail=bm;
}
if(description==null){ //8
description =new TaskDescription(); //9
}
} //10
【问题1】(2分)
请简述基本路径测试法的概念。
【问题2】(8分)
请画出上述程序的控制流图,并计算其控制流图的环图复杂度V(G)。
【问题3】(5分)
请给出问题2中的控制流图的线性无关路径。
正确答案及解析
正确答案
解析
【问题1】
基本路径测试法是在程序控制流图的基础上,通过分析控制构造的环路复杂性,导出基本可执行路径集合,从而设计测试用例的方法。设计出的测试用例要保证在测试中程序的每个可执行语句至少执行一次。
【问题2】
控制流图是描述程序控制流的一种图示方法。其基本符号有圆圈和箭线:圆圈为控制流图中的一个结点,表示一个或多个无分支的语句;带箭头的线段称为边或连接,表示控制流。基本结构如下所示:
控制流程图的环路复杂性 V(G)等于:
(1)控制流程图中的区域个数。
(2)边数-结点数+2。
(3)判定数+1。
V(g)=5
【问题3】
线性无关路径是指包括一组以前没有处理的语句或条件的一条路径。从控制流图来看,一条线性无关路径是至少包含有一条在其他线性无关路径中从未有过的边的路径:
1:1、2、3、8、10
2:1、2、4、5、6、8、10
3:1、2、3、4、5、6、8、10
4:1、2、4、5、7、8、10
5:1、2、3、8、9、10
(或者与之等价的)
包含此试题的试卷
你可能感兴趣的试题
( )is that it provides guidance and direction on how quality will be managed and verified throughout the project.
-
- A.Plan Quality Management
- B.Manage Quality
- C.Control Quality
- D.Project Charter
- 查看答案
( )the process of determining,documenting,and managing stakeholder needs and requirements to meet Project objectives.
-
- A.Plan Scope Management
- B.Collection Requirements
- C.Validate Scope
- D.Control Scope
- 查看答案
The information security management system preserves the confidentiality,integrity and availability of information by applying a( ).
-
- A.technology management process
- B.resource management process
- C.quality management process
- D.risk management process
- 查看答案
( )is a decentralized database,ensure that the data will not be tampered with and forged.
-
- A.Artificial intelligence
- B.Blockchain
- C.Sensing technology
- D.Big datA
- 查看答案
( )puts computer resources on the web,and must meet the requirements of super capacity,super concurrency,super speed and super security.
-
- A.Cloud computing
- B.Big datA
- C.Blockchain
- D.Internet of things
- 查看答案