单选题
下列程序的输出结果是:
下列程序的输出结果是:
public class Test{
public static void main(String[] args){
int [] array={2,4,6,8,10};
int size=6;
int result=-1;
try{
for(int i=0;i if(array[i]==20) result=i;
}
catch(ArithmeticException e){
System.out.println("Catch---1");
catch(ArrayIndexOutOfBoundsException e){
System.out.println("Catch---2");
catch(Exception e){
System.out.println("Catch---3");
}
}
}
catch(ArithmeticException e){
System.out.println("Catch---1");
catch(ArrayIndexOutOfBoundsException e){
System.out.println("Catch---2");
catch(Exception e){
System.out.println("Catch---3");
}
}
A
Catch---1
B
Catch---2
C
Catch---3
D
以上都不对
答案解析
正确答案:B
解析:
if()是永假
当i循环到5时,出问题了,存在数组下标越界异常
当i循环到5时,出问题了,存在数组下标越界异常
题目纠错
信息技术知识大赛
相关题目
单选题
下列聚合函数中不忽略空值 (null) 的是( )
单选题
在关系模式R(A,B,C,D)中,有函数依赖集F={B→C,C→D,D→A},则R能达到( )
单选题
关系模型中3NF是指( )
单选题
下列哪些运算是关系代数的基本运算( )
单选题
事务的原子性是指( )
单选题
保护数据库,防止未经授权或不合法的使用造成的数据泄漏、非法更改或破坏。这是指数据的( )
单选题
以下四个叙述中,哪一个不是对关系模式进行规范化的主要目的( )
单选题
下面的两个关系中,职工号和设备号分别为职工关系和设备关系的关键字:
职工(职工号,职工名,部门号,职务,工资)
设备(设备号,职工号,设备名,数量)
两个关系的属性中,存在一个外关键字为( )
单选题
关系模式的任何属性( )
单选题
数据库中,数据的物理独立性是指( )
