1、针对下列程序段,需要()个测试用例才可以满足语句覆盖的要求。 switch (value ) { case 0: other = 30; break; case 1: other = 50; break; case 2: other = 300; case 3: other = other/value; break; default: other = other * value; }A.2B.3C.4D.5

1、针对下列程序段,需要()个测试用例才可以满足语句覆盖的要求。 switch (value ) { case 0: other = 30; break; case 1: other = 50; break; case 2: other = 300; case 3: other = other/value; break; default: other = other * value; }

A.2

B.3

C.4

D.5


参考答案和解析
4

相关考题:

以下程序的运行结果是 【 9 】 。main( ){ int a=2,b=7,c=5;switch(a0){ case 1:switch(b0){ case 1: printf ("@"); break;case 2: printf("!"); break;}case 0: switch(c==5){ case 0 : printf (" * "); break;case 1 : printf(" # "); break;case 2: printf(" $ "); break;}default : printf("");}printf("\n");}

( 18 )以下选项中与 if ( a==1 ) a=b; else a++; 语句功能不同的 switch 语句是A )switch ( a ){case : a=b ; break ;default:a++ ;}B )switch ( a==1 ){case 0 : a=b ; break ;case 1 : a++ ;}C )switch ( a ){default : a++ ; break ;case 1 : a=b ;}D )switch ( a==1 ){case 1 : a=b ; break ;case 0 : a++ ;}

针对下列程序段,需要(52)个测试用例才可以满足语句覆盖的要求。 switch(value){ case 0: ther=30; break; case 1: ther=50; break; case 2: ther=300; case 3: ther=other/value; break; default: ther=other * value; }A.2B.3C.4D.5

针对下列程序段,需要______个测试用例才可以满足语句覆盖的要求。Switch(value){Case 0:0ther=30;Break;Case 1:ther=50;Break;Case 2:ther=300;Case 3:ther=other/value;Break;Default:ther=other * value;}A) 2B) 3C) 4D) 5A.B.C.D.

已知如下代码: switch(m) { case 0: System.out.println("Condition0"); case 1: System.out.println("Condition 1"); case 2: System.out.println("Condition 2"); case 3: System.out.println("Condition 3"); break; default: System.out.println("Other cCndition"); } 当m为( )时,"Condition 2"会出现在输出结果中。A.2B.0、1C.0、1、2D.0、1、2、3

以下选项中与“if(a= =l)a=b;else a++;”语句功能不同的switch语句是( )。A.switch(a) {case l:a=b;break; default:a++; }B.switch(a= =l) {case 0:a=b;break; case l:a++; }C.switch(a) {default:a++;break; case l:a=b; }D.switch(a= =l) {case l:a=b;break; case 0:a++; }

以下程序的运行结果是( )。main()(int a=2,b=7,c=5;switch(a>0){case 1:switch(b<0){case 1:switch(");break;case 2:printf("!");break;}case 0:switch(c==5){case 0:printf("*");break;case 1:printf("");break;case 2:printf("$");break;}default:printf ("&");}printf("\n");}

public static void main(String[]args){Integer i=new Integer(1)+new Integer(2);switch(i){case3:System.out.println(three);break;default:System.out.println(other);break;}}Whatistheresult?()A.threeB.otherC.Anexceptionisthrownatruntime.D.Compilationfailsbecauseofanerroronline12.E.Compilationfailsbecauseofanerroronline13.F.Compilationfailsbecauseofanerroronline15.

若a,b,c1,c2,x,y均是整型变量,正确的switch语句是______。A.switch(a+b); {case 1:y=a+b;break; case 0:y=a-b;break; }B.switch(a*a+b*b) {case 3; case 1:y=a+b;break; case 3:y=b-a;break; }C.switch a {case c1:y=a-b;break; case c2;x=a*b;break; default:x=a+b; }D.switch(a-b) {default:y=a*b;break; case 3:case 4:x=a+b;break; case 10:case11:y=a-b;break; }

已知:int a,b;下列switch语句中,( )是正确的。A.switdh (a) { case a: a + +;break; case b: b + +;break; }B.switch(a+b) { case 1:a+b;break; case 1:a-b }C.switch(a*a) { case 1,2:+ +a; case 3, 4:+ +b: }D.switch(a/10+b) { cases 5:a/5:break: default:a+b; }

给出下列的程序段,m为何值时将会输出default? ( ) switch(m) { case 0: System.out.println("case 0"); case 1:System.out.println("case 1");break; case 2:System.out.println("case 2");break; default:System.out.println("default"); }A.0B.1C.2D.3

若a、b、c1、c2、x、y均是整型变量,则正确的switch语句是______。A.swich(a+b); { case 1:y=a+b;break; case 0:y=a-b;break; } case 3:y=b-a, break;B.switch(a*a+b*b) { case 3: case 1:y=a+b;break; }C.switch a { case c1:y=a-b;break; case c2:x=a*d;break; default:x=a+b; }D.switch(a-b) { default:y=a*b;break; case 3:case 4:x=a+b;break; case 10:case 11:y=a-b;break; }

若a、b、c1、c2、x、y均是整型变量,则正确的switch语句是( )。A.switch(a+b); { casel:y=a+b;break; case0:y=a-b;break; }B.switch(a*a+b*b) { case 3: case 1:y=a+b;break; case 3:y=b-a;break; }C.switch a {case c1:y=a-b;break; case c2:x=a*d;break; default:x=a+b; }D.switch(a-b) {default:y=a*b;break; case 3:case 4:x=a+b;break; case 10:case 11:y=a—b;break; }

以下选项中与iF(a==1)a=B;elsea++;语句功能不同的sWish语句是A.sWitch(a){case1:a=B;Break; deFault:a++;}B.sWitch(a==1){case0:a=B;Break; case1:a++;}C.sWitch(a){DeFault:a++;Break; case1:a=B;}D.sWitch(a==1){case1:a=B;Break; case0:a++;}

给出下列的程序片段,m为( )时将会输出default。 switch (m) case ():Systemt.out.println("case 0"); case 1: System.out.println("case 1");break; case 2:System.out.println("case2");break; default:System.out.println("default");A.0B.1C.2 2D.3

给出下列的程序代码片段,m为哪个值时将会输出default? switch(m) { case 0:System.out.println("case0"); case 1:System.out.println("case 1");break; case 2:System.out.println("case 2");break; default:System.out.println("default"); }A.0B.1C.2D.3

以下程序段的输出结果为( )。 int j=2 switch (j){ Case 2: system.out.print("two."): Case 2+1: System.out.println("three."); break: default: System.out.println (“value is”+j): Break }A.B.twoA.two.three.B.twoC.threeD.value is 2

已知如下代码: switch(m) { case 0: System. out. println("Condition 0 "); case 1: System. out. println("Condition 1 "); case 2: System. out. println("Condition 2 "); case 3: System. out. println("Condition 3 "); break; default: System. out. println("Other Condition"); 当m的值为( )时,可以输出“Condition 2”。A.2B.0,1C.0,1,2D.0,1,2,3

若有定义语句int a,b;double x;则下列选项中没有错误的是( )。A.switch(x%2) {case O:a++;break; case 1:b++;break; default:a++;b++; }B.switch((int)x/2.0) {case O:a++;break; case 1:b++;break; default:a++;b++; }C.switch((int)x%2) {case O:a++;break; case 1:b++;break; default:a++;b++; }D.switch((int)(x)%2) {case 0.O:a++;break; case 1.0:b++;break; default:a++;b++; }

若a,b,c1,c2,x,y均是整型变量,正确的switch语句是( )。A.switch(a+b)B.switch(a*a+b*b) { case:y=a+b;break; { case 3: case:y=a-b;break; case 1:y=a+b;break; } case 3:y=b-a;break; }C.switchaD.switch(a-b) { casec1:y=a-b;break; { default:y=a*b;break; casec2:x=a*b;break; case 3:case4:x=a+b;break; default:x=a+b; case 10:case 11:y=a-b;break; } }

若有定义语句“int a,b;double X;”,则下列选项中没有错误的是( )。A.switch(X%2) { case 0:a++;break; case l:b++;break; default:a++;b++; }B.switch((int)x/2.O) { case 0:a++;break; case l:b++;break; default:a++;b++; }C.switch((int)X%2) { case 0:a++;break; case l:b++;break; default:a++;b++; }D.switch((int)(x)%2) { case 0.0:a++;break; case l.0:b++;break; default:a++;b++; }

已知:int a,b;下列switch语句中,( )是正确的。A.switdh(a) { case a: a++;break; case b: b++:break: }B.switch(a+b) { case 1:a+b; break; case 1:a-b }C.switch(a*a) { case1,2:++a; case3,4:++b; }D.swish(a/l0+b) { cases 5:a/5;break; default:a+b: }

针对下列程序段,需要______个测试用例才可以满足语句覆盖的要求。Switch(value){Case 0:ther=30;Break;Case 1:ther=50;Break;Case 2:ther=300;Case 3:ther=other/value;Break;Default;ther=other*value;}A) 2B) 3C) 4D) 5A.B.C.D.

针对下列程序段,需要( )个测试用例才可以满足语句覆盖的要求。switch(value){case 0:other=30;break;case 1:other=50;break;case 2:other=300;case 3:other=other/value;break;default:other=other*value;}A.2B.3C.4D.5

public static void main(String[]args){ Integer i=new Integer(1)+new Integer(2); switch(i){ case3:System.out.println("three");break; default:System.out.println("other");break; } } Whatistheresult?()A、threeB、otherC、Anexceptionisthrownatruntime.D、Compilationfailsbecauseofanerroronline12.E、Compilationfailsbecauseofanerroronline13.F、Compilationfailsbecauseofanerroronline15.

单选题若有定义语句int a,b;double x;则下列选项中没有错误的是(  )。Aswitch(x%2){ case 0:a++;break; case 1:b++;break; default:a++;b++;}Bswitch((int)x/2.0){ case 0:a++;break; case 1:b++;break; default:a++;b++;}Cswitch((int)x%2){ case 0:a++;break; case 1:b++;break; default:a++;b++;}Dswitch((int)(x)%2){ case 0.0:a++;break; case 1.0:b++;break; default:a++;b++;}

单选题以下选项中与if(a==1) a=b;else a++;语句功能不同的switch语句是(  )。Aswitch(a){ case 1: a=b; break; default: a++;}Bswitch(a==1){ case 0: a=b; break; case 1:a++;}Cswitch(a){ default :a++; break; case 1: a=b;}Dswitch(a==1){ case 1: a=b;break; case 0: a++;}

单选题public static void main(String[]args){ Integer i=new Integer(1)+new Integer(2); switch(i){ case3:System.out.println("three");break; default:System.out.println("other");break; } } Whatistheresult?()AthreeBotherCAnexceptionisthrownatruntime.DCompilationfailsbecauseofanerroronline12.ECompilationfailsbecauseofanerroronline13.FCompilationfailsbecauseofanerroronline15.