题目详情

阅读下列C程序,回答下列问题。

[C程序] int GetMaxDay( int year, intmonth ) { int maxday = 0; //1 if ( month >= 1 && month <= 12 ) { //2,3 if ( month == 2 ) { //4 if ( year % 4 == 0 ) { //5 if ( year % 100 == 0 ) { //6 if ( year % 400 == 0 ) } //7 maxday = 29; //8 else //9 maxday = 28; } else //10 maxday = 29; } else //11 maxday = 28; } else{ //12 if(month==4||month==6||month==9||month==11) //13, 14, 15, 16 maxday = 30; //17 else //18 maxday = 31; } } return maxday; //19 }

3、请给出问题2中控制流图的线性无关路径。

正确答案及解析

正确答案
解析

线性无关路径:

1.1-2-19

2.1-2-3-19

3.1-2-3-4-12-13-14-15-16-18-19

4.1-2-3-4-12-13-14-15-16-17-19

5.1-2-3-4-12-13-14-15-17-19

6.1-2-3-4-12-13-14-17-19

7.1-2-3-4-12-13-17-19

8.1-2-3-4-5-11-19

9.1-2-3-4-5-6-10-19

10.1-2-3-4-5-6-7-9-19

11.1-2-3-4-5-6-7-8-19

【解析】

第三小题考查白盒测试用例设计方法中的基本路径法。

涉及到的知识点是根据控制流图和环路复杂度给出线性无关路径。

线性无关路径是指包含一组以前没有处理的语句或条件的路径。从控制流图上来看,一条线性无关路径是至少包含一条在其他线性无关路径中从未有过的边的路径。程序的环路复杂度等于线性无关路径的条数,所以本题中应该有11条线性无关路径。

你可能感兴趣的试题

单选题

Advancements in ( )have contributed to the growth of the automotive industry through the creation and evolution of self-driving vehicles.

  • A.Artificial Intelligence
  • B.Cloud Computing
  • C.Internet of Things
  • D.Big Data
查看答案
单选题

In project human resource management , ( )is not a source of power for the project manager.

  • A.referent power
  • B.expert power
  • C.reward power
  • D.audit power
查看答案
单选题

At the project establishment stage , the feasibility study mainly includes techinical feasibility analysis , ( ), operation environment feasibility analysis and other aspects of feasibility analysis.

  • A.detail feasibility analysis
  • B.opportunity analysis
  • C.economic feasibility analysis
  • D.risk analysis
查看答案
单选题

( )is a grid that shows the project resources assigned to each work package.

  • A.Stakeholder engagement assessment matrix
  • B.Requirements traceability matrix
  • C.Probability and impact matrix
  • D.Responsibility assignment matrix
查看答案
单选题

Xinhua News Agency reported in January 2022,Chian will further promote the developmet of a digital economy during the 14th Five-Year Plan eriod(2021-2025). The plan also emphasized industrial ( )transformation.

  • A.digital
  • B.networking
  • C.intelligentize
  • D.informatization
查看答案

相关题库更多 +