网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

阅读下列C程序,回答问题1至问题3,将解答填入答题纸的对应栏内。 【C程序】 int count(int x,int z){ inty=0; while(x>0){ //l if(x==1) //2 y=7; //3 else{ //4 y=x+z+4; if(y=7||y=21) //5,6 x=1; //7 } x--; //8 } return y; //9 }

【问题1】(3分) 请针对上述C程序给出满足100%DC(判定覆盖)所需的逻辑条件。 【问题2】(7分) 请画出上述程序的控制流图,并计算其控制流图的环路复杂度V(G)。 【问题3】(5分) 请给出问题2中控制流图的线性无关路径。


参考答案

更多 “ 阅读下列C程序,回答问题1至问题3,将解答填入答题纸的对应栏内。 【C程序】 int count(int x,int z){ inty=0; while(x0){ //l if(x==1) //2 y=7; //3 else{ //4 y=x+z+4; if(y=7||y=21) //5,6 x=1; //7 } x--; //8 } return y; //9 }【问题1】(3分) 请针对上述C程序给出满足100%DC(判定覆盖)所需的逻辑条件。 【问题2】(7分) 请画出上述程序的控制流图,并计算其控制流图的环路复杂度V(G)。 【问题3】(5分) 请给出问题2中控制流图的线性无关路径。 ” 相关考题
考题 有以下程序:includeint f(int x){int y;if(x==0||x==1)return(3);y=x*x-f(x-2);return 有以下程序: #include<stdio.h> int f(int x) {int y; if(x==0||x==1)return(3); y=x*x-f(x-2); return y; } main() {int z; z=f(3);printf("%d\n",z); } 程序的运行结果是( )。A.0B.9C.6D.8

考题 有以下程序#include stdio.hint f(int x){ int y;if(x==0||x==1) return(3);y=x*x-f(x-2);return y;}main(){ int z;z=f(3); printf("%d\n",z);}程序的运行结果是A.0B.9C.6D.8

考题 使用VC6打开老考生文件夹下的工程test5_1,此工程包含一个源程序文件test5_1.cpp,但该程序运行有问题,请改正程序中的错误,使程序的输出结果如下:x=3 y=5 z=08源程序文件test5_1.cpp清单如下:include<iostream.h>static int x=5;int z=0;int *add(int x,int y){cout<<"X="<<X<<"y="<<y<<" Z="<<z<<endl;z=z+x+y;/********found*********/return z;/********found*********/};void main(){int y=5;int x=3;/*********found********/cout<<(add(X,y))<<endl;}

考题 下列程序的输出结果是includeclass Myclass{public:Myclass(int i=0,int j=0){x=i; 下列程序的输出结果是 #include<iostream.h> class Myclass{ public:Myclass(int i=0,int j=0) { x=i; y=j; } void show( ) {cout < <"x=" < < x < <" " <"y=" < < y < < endl;} void show( ) const{cout < <"x=" < <" " < <"y=" < < y < < endl;} privated: int x; int y; }; void main( ) { Myclass my1(3,4) ; const my2(7,8) ; my1.show( ) ;my2.show( ) ;}A.x=4,y=3;x=7,y=8B.x=3,y=4;x=7,y=8C.x=7,y=8;x=4,y=3D.x=8,y=7;x=7,y=8

考题 有以下程序includeintf(intx){inty;if(x==0||x==1)return(3);y=x*x-f(x-2);returny;}m 有以下程序 #include <stdio.h> intf(int x) { int y; if(x==0||x==1) return(3); y=x*x-f(x-2); return y; } main() { int z; z=f(3); printf("%d\n",z); } 程序的运行结果是A.0B.9C.6D.8

考题 有下列程序: include int f(int x) { int y; if(x=0‖x==1)r 有下列程序: #include <stdio.h> int f(int x) { int y; if(x=0‖x==1)return(3); y=x*x-f(x-2); return y; } main() { int z; z=f(3);printf("%d\n",z); 程序的运行结果是( )。A.0B.9C.6D.8

考题 有以下程序:includeint fun(int x,int y){if(x==y)return(x);else return((x+y)/2);}m 有以下程序: #include<stdio.h> int fun(int x,int y) {if(x==y)return(x); else return((x+y)/2); } main() {int a=1,b=2,c=3; printf("%d\n",fun(2*a,fun(b,C))); } 程序运行后的输出结果是( )。A.2B.3C.4D.5

考题 有以下程序includeint f(intx){inty; if(x==0||x==1)return(3); y=x*x-f(x-2); return 有以下程序 #include <stdio.h> int f(int x) { int y; if(x==0||x==1) return(3); y=x*x-f(x-2); return y; } main() { int z; z=f(3); printf("%d\n",z); } 程序的运行结果是A.0B.9C.6D.8

考题 若有以下程序段;includeusing namespace std;int main(){ int a[]={1,4,5}; int *p=a[0],x=6,y,z; for(y=0;y<3;y++) z=((*(p+y)<x) ? *(p+y):x); cout<<z<<end1; return 0; } 程序运行后的输出结果是( )。A.1B.4C.5D.2

考题 阅读下面程序:include fun (int a, int b){int c;c=a+b;return c;}void main(){int 阅读下面程序:#include <iostream.h>fun (int a, int b){int c;c=a+b;return c;}void main(){int x=6, y=7, z=8, r;r=fun( (x--, y++, x+y), z--);cout<<r<<end1;}则该程序的输出结果是( )。A.11B.20C.21D.31

考题 根据源代码请回答以下问题。 void sort( int Num, int Type ){ int x = 0; int y = 0; while (Num 0) { if( Type = = 0) x = y + 2; else { if( Type = = 1 ) x = y + 5; else x = y + 10; } Num--; } } (1) 请画出控制流图并计算控制流图复杂度V(G) 。 (2) 找出独立路径。 (3) 请使用基本路径测试法设计测试用例。 (4) 根据控制流图,找出变量x和y的DU path

考题 请读程序:includefunc(int a, int b){int c; c=a+b; return c;}main(){int x=6,y=7,z= 请读程序: #include <stdio.h> func(int a, int b) { int c; c=a+b; return c; } main() { int x=6,y=7,z=8,r; r=func((x--,y++,x+y),z--); printf("%d\n",r); 上面程序的输出结果是( )。A.11B.20C.21D.31

考题 阅读以下代码,回答问题:1至问题3 ,将解答填入答题纸的对应栏内。 【代码1】 includestdio.h void swap(int x, int y) { int tmp =x; x= y; y= tmp; } int maim() { int a= 3, b= 7; printf(a1= %d b1=%d\n,a,b); Swap( a, b); Printf(a2 = %d b2=%d\n,a,b); return 0; } 【代码2】 includestdio.h define SPACE //空格字符 Int main() { char str[128] = Nothing is impossible! ; int i,num =0,wordMark=0; for(i=0;str[i];i++) If(str[i]==SPACE) WordMark=0; else If(wordMark=0){ wordMark=1; num++; } Printf(%d/n,num) return 0; } 【代码3】 includestdio.h define SPACE //空格字符 int countStrs(char *); int main() { char str[128] = Nothing is impossible! ; Printf(%d/n,(1)(str)) return 0; } int countStrs(char *p) { int num=0, wordMark= 0; for(;(2); p++) { If((3)==SPACE) wordMark= 0; else if( !wordMark ) { wordMark = 1; ++num } } return (4) ; }【问题1】(4分) 写出代码1运行后的输出结果。 【问题2】(3分) 写出代码2运行后的输出结果。 【问题3】(8分) 代码3的功能与代码2完全相同,请补充3中的空缺,将解答写入答题纸的对应栏内。

考题 有以下程序:include void f(int * x,int * y) int t;t= *x; *x= *y; *y=t;main ( ){in 有以下程序:#include <stdio.h>void f(int * x,int * y) int t; t= *x; *x= *y; *y=t;main ( ){ int a[8] = { 1,2,3,4,5,6,7,8} ,i, * p, * q; p=a;q =a[7]; while(p<q) { f(p,q) ;p ++ ;q --; } for(i =0;i<8;i ++ ) printf(" % d," ,a[i]); }程序运行后的输出结果是( )。A.8,2,3,4.,5,6,7,1,B.5,6,7,8,1,2,3,4,C.1,2,3,4,5,6,7,8,D.8,7,6,5,4,3,2,1,

考题 阅读下列说明,回答问题1至问题3,将解答填入答题纸的对应栏内。【说明】逻辑覆盖法是设计白盒测试用例的主要方法之一,通过对程序逻辑结构的遍历实现程序的覆盖。针对以下由C语言编写的程序,按要求回答问题。【问题1] (6分)请给出满足100%DC(判定覆盖)所需的逻辑条件。【问题2] (10分)请画出上述程序的控制流图,并计算其控制流图的环路复杂度V(G)。【问题3](4分)请给出问题2中控制流图的线性无关路径。

考题 阅读下列C程序,回答问题1至问题3,将解答填入答题纸的对应栏内。【C程序】【问题1】(6分)请针对上述C程序给出满足100%DC(判定覆盖)所需的逻辑条件。【问题2】(9分)请画出上述程序的控制流图,并计算其环路复杂度V(G)。【问题3】(5分)请给出问题2中控制流图的线性无关路径。

考题 阅读以下C++代码,填充(1)~(5)的空缺,将解答填入答题纸的对应栏内。 【说明】在下面程序横线处填上适当的字句,使其输出结果为:x=5x=6y=7x=8z=9【程序】#include<iostream.h>class X1{int x;(1):X1(int xx=0){x=xx;}(2)void Output()(cout<<"x="<<x<<end;}};(3)Y1:public X1{int y;public:Y1(int xx=0,int yy=0):X1(xx){y=yy;}(2)void Output(){(4)Output();cout<<"y="<<y<<end1;}};class Z1:pubtic X1{int z:(5):Z1(int xx=0,int zz=0):X1(xx){z=zz;}②void Output(){X1::Output();cout<<"z="<<z<<end1;}};void main(){X1 a(5);Y1 b(6,7);Z1 c(8,9);X1*p[3]={For(int i=0;i<3;i++){p[i]-->Output();cout<<end1;}}

考题 阅读下列C程序,回答问题1至问题3,将解答填入答题纸的对应栏内。【说明】逻辑覆盖法是设计白盒测试用例的主要方法之一,它是通过对程序逻辑结构的遍历实现程序的覆盖。针对以下由C 语言编写的程序,按要求回答问题。 问题1:(6分) 请针对上述C程序,给出满足100%DC(判定覆盖)所需的逻辑条件。 问题2:(7分)请画出上述程序的控制流图,并计算其控制流图的环路复杂度V(G)。 问题3:(3分)请给出【问题2】中控制流图的线性无关路径。

考题 阅读下列C程序,回答下列问题。 [C程序] int GetMaxDay( int year, intmonth ) { int maxday = 0; //1 if ( month >= 1 //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 } 1、请针对上述C程序给出满足100%DC(判定覆盖)所需的逻辑条件。

考题 阅读下列C程序,回答问题1至问题3,将解答填入答题纸的对应栏内。 【问题1】(3分)请针对上述C程序给出满足100%DC(判定覆盖)所需的逻辑条件。【问题2】(8分)请画出上述程序的控制流图,并计算其控制流图的环路复杂度V(G)。

考题 阅读下列C程序,回答问题1至问题3,将解答填入答题纸的对应栏内。【C程序】int count(int x,int z){int y=0;while(x>0){ //lif(x==1) //2y=7; //3else{ //4y=x+z+4;if(y=7||y=21) //5,6x=1; //7}x--; //8}return y; //9 问题:1.1 (3分)请针对上述C程序给出满足100%DC(判定覆盖)所需的逻辑条件。 问题:1.2 (7分)请画出上述程序的控制流图,并计算其控制流图的环路复杂度V(G)。 问题:1.3 (5分)请给出问题2中控制流图的线性无关路径。

考题 阅读下列程序,回答问题1至问题3,将解答填入答题纸的对应栏内。【说明】逻辑覆盖法是设计白盒测试用例的主要方法之一,它是通过对程序逻辑结构的遍历实现程序的覆盖。针对以下由C 语言编写的程序,按要求回答问题。 问题1:(5分)请给出满足100%DC(判定覆盖)所需的逻辑条件。 问题2:(7分)请画出上述程序的控制流图,并计算其控制流图的环路复杂度V(G)。 问题3:(3分)请给出【问题2】中控制流图的线性无关路径。

考题 阅读下列C程序,回答问题1至问题3,将解答填入答题纸的对应栏内。 【C程序】 int count(int x,int z){int y=0;while(x>0){ //lif(x==1) //2y=7; //3else{ //4y=x+z+4;if(y=7||y=21) //5,6x=1; //7}x--; //8}return y; //9} 问题1: (3分) 请针对上述C程序给出满足100%DC(判定覆盖)所需的逻辑条件。 问题2: (7分) 请画出上述程序的控制流图,并计算其控制流图的环路复杂度V(G)。 问题3: (5分) 请给出问题2中控制流图的线性无关路径。

考题 阅读下列说明,回答问题1至问题3,将解答填入答题纸的对应栏内。 逻辑覆盖法是设计白盒测试用例的主要方法之一,它通过对程序逻辑结构的遍历实现程序的覆盖。针对以下由C语言编写的程序,按要求回答问题。 gz_open (const char*mode) { char*p= (char*)mode; //1 char fmode[4]; char*m=fmode; char smode= '\0'; char level='\0\'; int strategy=0; do { if (*p=='r') //2 smode - 'r'; //3 if (*p>='O' //6 } else if (*p=='f') { //7 strategy=1; //8 }else { //9 *m++=*p; } *p++; //10 }while (m!=fmode+sizeof (fmode)); //11 } //127、请给出满足100%DC(判定覆盖)所需的逻辑条件。8、请画出上述程序的控制流图,并计算其控制流图的环路复杂度VG.。9、假设函数gz_open的参数mode是由26个小写字母'a'-'z'、数字'0'-'9'以及空格组成的字符串,请使用基本路径测试法构造1个测试用例,使之覆盖所有基本路径。

考题 阅读下列C程序,回答问题1至问题3,将解答填入答题纸的对应栏内。 问题1:(3分) 请针对上述C程序,给出满足100%DC(判定覆盖)所需的逻辑条件。 问题2:(7分)请画出上述程序的控制流图,并计算其控制流图的环路复杂度V(G)。 问题3:(3分)请给出【问题2】中控制流图的线性无关路径。

考题 阅读下列C程序,回答下列问题。 [C程序] int GetMaxDay( int year, int month ) { int maxday = 0; //1 if ( month >= 1 //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.1、请针对上述C程序给出满足100%DC(判定覆盖)所需的逻辑条件。(6分)3.2、请画出上述程序的控制流图,并计算其环路复杂度V(G)。(9分)3.3、请给出问题2中控制流图的线性无关路径。(5分)

考题 单选题有以下程序:#include int f(int x){ int y; if(x==0||x==1)  return (3); y=x*x-f(x-2); return y;}main(){ int z; z=f(3); printf(%d,z);}程序的运行结果是(  )。A 0B 9C 6D 8