阅读下列C程序,回答下列问题。
请画出上述程序的控制流图,并计算其环路复杂度VG.。
控制流图
第二小题考查白盒测试用例设计方法之基本路径法。
涉及到的知识点包括根据代码绘制控制流图、计算环路复杂度。
控制流图是描述程序控制流的一种图示方式,它由节点和定向边构成。控制流图的节点代表一个基本块,定向边代表控制流的方向。其中要特别注意的是,如果判断中的条件表达式是复合条件,即条件表达式是由一个或多个逻辑运算符连接的逻辑表达式,则需要改变复合条件的判断为一系列之单个条件的嵌套判断。本题程序中,if(month>=1 && month<=12)这条判断语句中的判定由两个条件组成,因此在画控制流图的时候需要拆开成两条判断语句。同理,if(month==4||month=6||month==9||month=11)这条判断语句中的判定由4个条件组成,因此在画控制流图的时候需要拆开成4条判断语句。这里需要注意的是,如果复合条件之间是"&&"的关系,则拆开后反应在控制流图上是沿左子树往下,反之如果条件之间是"||"的关系,则在控制流图上是沿右子树往下。
程序的环路复杂度等于控制流图中判定节点的个数加1,本题控制流图中判定节点个数为10,所以V(G)=11。
( )is the process of transforming information so it is unintelligible to anyone but the intended recipient.
As each application module is completed,it undergoes( )to ensure that it operates correctly and reliably.
( )algorithm specifies the way to arrange data in a particular order.
After analyzing the source code,( )generates machine instructions that will carry out the meaning of the program at a later time.
( )can help organizations to better understand the information contained within the data and will also help identify the data that is most important to the business and future business decisions.
浏览器开启无痕浏览模式后,( )依然会被保存下来。
下列协议中,不属于TCP/IP协议簇的是( )。
下列传输介质中,带宽最宽、抗干扰能力最强的是( )。
数控编程常需要用参数来描述需要加工的零件的图形。在平面坐标系内,确定一个点需要2个独立的参数,确定一个正方形需要( )个独立的参数。
某书的页码为1,2,3,...,共用数字900个(一个多位数页码包含多个数字),据此可以推断,该书最大的页码为( )。