更多"如果程序通过了100%的代码覆盖率测试,则说明程序满足了______。"的相关试题:
[填空题]单元测试是以______说明书为指导,测试源程序代码。
[填空题]
阅读以下说明和C程序代码,将程序补充完整。
[说明]
下面C程序代码的功能是:对于输入的一个正整数n(100≤n<1000),先判断其是否是回文数(正读反读都一样的数)。若不是,则将n与其反序数相加,再判断得到的和数是否为回文数,若还不是,再将该和数与其反序数相加并进行判断,依此类推,直到得到一个回文数为止。例如,278不是回文数,其反序数为872,相加后得到的1150还不是回文数,再将1150与其反序数511相加,得到的1661是回文数。
函数int isPalm(long
m)的功能是:将正整数m的各位数字取出存入数组中,然后判断其是否为回文数。若m是回文数则返回1,否则返回0。
[C程序代码]
#include<stdio.h>
#include<stdlib.h>
int isPalm(long m)
{
int i=0, k=0;
char str[32];
while(m>0) {
str[k++]= (1) +’0’;
m=m/10;
}
for(i=0; i<k/2;
i++)
if(str[i]!=str[ (2) ])return 0;
return 1;
}
int main(
)
{
long n, a, t;
printf("input a positive integer: "); scanf("%ld", &n);
if(n<100||n>=1000)return -1;
while( (3)
) {
printf("%id->", n);
for(a=0, t=n;
t>0; ){
a= (4) *10+t%10; t=t/10;
n= (5) ;
printf("%id/n", n);
system("pause"); return 0;
[单项选择]关于以下程序代码的说明正确的是( )
(1) class HasStatic
(2) private static int x=100:
(3) public static void main (String args[]
(4) HasStatic hs1=new Has Static( );
(5) hs1.x + +;
(6) Has Static hs2=new HasStatic( );
(7) hs2.x + +;
(8) hs1=new HasStatic( );
(9) hs1.x + +:
(10) System.out.println("x="+ x);
(11)
(12)
A. (5)行不能通过编译,因为引用了私有静态变量
B. (10)行不能通过编译,因为x是私有静态变量
C. 程序通过编译,输出结果为:x=103
D. 程序通过编译,输出结果为:x=100
[单项选择]关于以下程序代码的说明正确的是 ( )(1)class HasStatic{(2)private static int x=100;(3)public static void main(String args[]){(4)HasStatic hs1=new HasStatic( );(5)hs1.x++;(6)HasStatic hs2=new HasStatic( );(7)hs2.x++;(8)hs1=new HasStatic( );(9)hs1.x++;(10)System.out.println("x="+x);(11)}(12)}
A. (5)行不能通过编译,因为引用了私有静态变量
B. (10)行不能通过编译,因为x是私有静态变量
C. 程序通过编译,输出结果为:x=103
D. 程序通过编译,输出结果为:x=100
[单项选择]关于以下程序代码的说明正确的是( ) (1) class HasStatic{ (2) private static int x=100: (3) public static void main (String args[]{ (4) HasStatic hs1=new Has Static( ); (5) hs1.x + +; (6) Has Static hs2=new HasStatic( ); (7) hs2.x + +; (8) hs1=new HasStatic( ); (9) hs1.x + +: (10) System.out.println("x="+ x); (11) } (12) }
A. (5)行不能通过编译,因为引用了私有静态变量
B. (10)行不能通过编译,因为x是私有静态变量
C. 程序通过编译,输出结果为:x=103
D. 程序通过编译,输出结果为:x=100
[简答题]采用条件覆盖为下面的程序设计测试用例,要求条件覆盖率达到100%。
已知程序源代码如下:
dim a,b As Integer
dim c As Double
if(a>0 And b>0)then c=c/a
endif
if(a>1 or c>1)then c=c+1
endif
c=a+b
[填空题]请阅读下列程序代码,然后将程序的执行结果补充完整。
程序代码:
public class throwsExcepfion{
static void Proc(int se1)
throws ArithmeticException,ArraylndexOutOfBoundsException {
System.out.println("in Situation"+se1);
if(se1==0){
System.out.println("no Exception caught");
return;
}else if(se1==1){
int iArray[]=new int[4];
iArray [1]=3;
}
}
public static void main(String args[])[
try{
Proc(0);
Proc(1);
} catch(ArraylndexOutOfBoundsException e) {
System.out.println("Catch"+e);
}finally{
System.out.println("in Proc finally");
}
}
}
执行结果:
In Situation( )
no ExcepbOn cauSht
【14】
in Proc findly
[填空题]请阅读下列程序代码,然后将程序的执行结果补充完整。
程序代码:
public class throwsExcepfion
static void Proc(int se1)
throws ArithmeticException,ArraylndexOutOfBoundsException
System.out.println("in Situation"+se1);
if(se1==0)
System.out.println("no Exception caught");
return;
else if(se1==1)
int iArray[]=new int[4];
iArray [1]=3;
public static void main(String args[])[
try
Proc(0);
Proc(1);
catch(ArraylndexOutOfBoundsException e)
System.out.println("Catch"+e);
finally
System.out.println("in Proc finally");
执行结果:
In Situation( )
no ExcepbOn cauSht
______
in Proc findly
[填空题]请阅读下列程序代码,然后将程序的执行结果补充完整。
程序代码:
Public class throwsException
static voidProc(intsel)
throws ArtthmeticExcepdon,AITaylndexOut of BoundsException
System.out println("In SimatiOn"+Sel);
if(sel==0)
System.out.println("noExceptioncallght");
return;
elseif(sel==1)
intiArray[]=newint[4];
i Array[1]=3;
public static void main(Stringargs[])
tfy
Proc(0);
Proc(1);
catch(ArraylndexOutOfBoundsExceptione)
System.out.println("Catch"+e);
flnally
Systern.out.println("inProcfinally");
执行结果:
In Situattion 0
no Exceptioncaught
inProcfinally
[填空题]请阅读下列程序代码,然后将程序的执行结果补充完整。
程序代码:
public class throwsException
static void Proc(int sel)
throws ArithmeticException,ArrayIndexOutOfBoundsException
System.out. println("In Situation"+sel);
if(sel==0)
System.out.println("no Exception caught");
return;
else if(sel==1)
int iArray[]=new int[4];
iArray[1]=3;
public static void main(String args[])
try
Proc(0);
Proc(1);
catch(ArrayIndexOutOfBoundsException e)
System.out.println("Catch"+e);
finally
System.out.println("in Proc finally");
执行结果:
In Situation 0
no Exception caught
______
in Proc finally