阅读以下程序,填写运行结果()。 def f(a,b): return str(a+b) print(f(1,2)+f(2,3))
第1题
阅读以下程序,填写运行结果()。def f(n): s=str(n) result='' for i in range(0,len(s)): result=s[i]+result return result print(f(345))
第3题
阅读以下程序,填写运行结果()。lst=[11,12,13,14,15] lst.sort(reverse=True,key=lambda x:x%7) print(lst[1])
第5题
第6题
第7题
第8题
阅读以下程序,给出运行结果。
classMultiCatch{
publicstaticvoidmain(Stringargs[]){
try{
inta=args.length;
intb=44/a;
intc[]={2,6};
c[44]=100;
System.out.println("b="+b);
}catch(ArithmeticExceptione){
System.out.println("除0异常");
}catch(ArrayIndexOutOfBoundsExceptione){
System.out.println("数组超越边界异常");
}finally{
System.out.println("程序执行结束");
}
}
}
运行结果是:
第9题
阅读以下 FORTRAN 程序:
READ(* , *)X
IF(X , LE , 0)RHEN
Y=0.0
ELSEIF(X , LT , 5 , 0) , AND , (X , NE , 2 , 0)THEN
Y=1 / X
ELSEIF(X , LE , 10 , 0)THEN
Y=1 / (X+2)
ELSE
Y=10.0
ENDIF
WRITE
WRITE(* , *)Y
END
运行上述程序时,若由键盘输入: 2 ,则程序输出结果为 () 。
(A)0.0
(B)0.5
(C)0.25
(D)10.0
第10题
阅读下面的程序,填写程序中缺少的部分,并把程序的输出结果写出来;
classTest{
staticvoidShowArrayInfo(int[]student){
for(inti=0;i
Console.Write(student[i]++);
Console.Write(“”);
}
}
staticvoidMain(){
int[]student=newint[]{1,2,3,4,5};
ShowArrayInfo(student);
Console.Write(“/n”);
ShowArrayInfo(student);
}
}
输出结果: