针对下列程序段,需要(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.2
B.3
C.4
D.5
A.2
B.3
C.4
D.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) 2
B) 3
C) 4
D) 5
针对下列程序段,需要______个测试用例才可以满足语句覆盖的要求。
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) 2
B) 3
C) 4
D) 5
针对下列程序段,需要(58)个测试用例可以满足分支覆盖的要求。 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
● 针对下列程序段,需要(58)个测试用例可以满足分支覆盖的要求。
int IsLeap(int year)
{
if (year % 4 == 0 )
{
if ((year % 100 == 0 )
{
if (year % 400 == 0 )
leap = 1;
else
leap = 0;
}
else
leap = 1;
}
else
leap = 0;
return leap;
}
(58)
A.3
B.4
C.6
D.7
针对下面的程序段,对于(MaxNum,Type)的取值,至少需要______个测试用例才能够满足判定覆盖的要求。
Whjle(MaxNum-->0)
{
If(10==Type)x=y * 2;
Else if(100==Type)x=y+20;
}
A) 5
B) 4
C) 3
D) 2
● 针对以下 C 语言程序段,对于(MaxNum,Type)的取值,至少需要(62)个测试用例能够满足判定覆盖的要求。
while (MaxNum-- > 0 )
{
if (10 == Type )
x = y * 2;
else
if (100 == Type )
x = y + 10;
else
x = y - 20;
}
(62)A.5 B. 4 C. 3 D. 2
● 针对以下程序段,对于变量 c 的取值,至少需要(61)个测试用例才能够满足语句覆盖的要求。
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;
}
(61)A.4 B.3 C.2 D. 1
A.5
B.4
C.3
D.2
int MathMine(int x)
{
int m=0;
int i;
for(i=x-1; i<=x+1; i++)
{
if (i<0) continue;
if (i>31) break;
if (sta[i]=-1) m++;
}
return m;
}
A.3
B.4
C.5
D.6
A.4
B.3
C.2
D.1
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!