更多"针对下列程序段,需要()个测试用例才可以满足语句覆盖的要求。 swit"的相关试题:
[单项选择]针对下列程序段,需要______个测试用例才可以满足语句覆盖的要求。
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
[单项选择]下列程序段的执行结果为( )
a=1
b=0
Select Case a
Case 1
Select Case b
Case 0
Print"* * 0 * *"
Case 1
Print"* * 1 * *"
End Select
Case 2
Print"* * 2 * *"
End Select
A. * * 0 * *
B. * * 1 * *
C. * * 2 * *
D. 0
[单项选择]下面程序段执行结果为
x=Int(Rnd( )+4)
Select Case x
Case 5
Print"excellent"
Case4
Print"good"
Case 3
Print"pass"
Case Else
Print"fail"
End Select
A. excellent B) good C) pass D) fall
[单项选择]下列程序段的执行结果为( )。
m=1
n=1
Select Case m
Case1
Select Case n
Case0
print“A”
Case 1
Print“B”
End Select
Case2
Pririt“C”
End Select
A. A
B. B
C. C
D. O
[填空题]下列程序段的执行结果是 【14】 。
x=Int(Rnd+4)
Select Case X
Case 5
Print"优秀"
Case 4
Print"良好"
Case 3
Print"合格"
Case Else
Print"不合格"
End Select
[单项选择]下列程序段有语法错误的行是______。
1 do case
2 case a>0
3 s=1
4 else
5 s=0
6 endcase
A. 2
B. 4
C. 5
D. 6
[单项选择]下列程序段的执行结果为
m=1
n=1
Select Case m
Case 1
Select Case n
Case 0
print "A"
Case 1
Print "B"
End Select
Case 2
Print "C"
End Select
A. A
B. B
C. C
D. 0
[单项选择]
针对下列程序段,需要()个测试用例可以满足分支覆盖的要求。
int IsLeap(int year)
if (year % 4==0)
if ( (year % 100==0)
if (year % 400==0)
leap=1;
else
leap=0;
else
leap=l;
else
leap=0;
return leap;
A. 3
B. 4
C. 6
D. 7
[单项选择]针对以下程序段,对于变量 c 的取值,至少需要( )个测试用例才能够满足语句覆盖的要求。
c = ((u8_t *)q->payload)[i];
switch (c)
{
case SLIP_END:
sio_send(SLIP_ESC, netif->state);
sio_send(SLIP_ESC_END, netif->state);
break;
case SLIP_ESC:
sio_send(SLIP_ESC, netif->state);
sio_send(SLIP_ESC_ESC, netif->state);
break;
default:
sio_send(c, netif->state);
break;
}
A. 4
B. 3
C. 2
D. 1
[单项选择]针对以下 C 语言程序段,对于(MaxNum,Type)的取值,至少需要( )个测试用例能够满足判定覆盖的要求。
while ( MaxNum-- > 0 )
{
if ( 10 == Type )
x = y * 2;
else
if ( 100 == Type )
x = y + 10;
else
x = y - 20;
}
A. 5
B. 4
C. 3
D. 2