- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
Java2006试卷
2006年上海市高等学校计算机等级考试试卷
二级 (Java程序设计)
(本试卷答卷时间120分钟)
试题一(28分,每小题4分)
解答下列各小题,每小题有四个备选答案A,B,C和D,其中只有一个是正确的,选出正确的答案,把答案写在答卷纸的对应栏内。
(1) 找出能使程序块显示字符串的x值域。
if (x0) System.out.println(excellent);
else if (x-3) System.out.println(good);
else System.out.println(normal);
A. x 0 B. x -3 C. x = -3 D. -3 x = 0
(2) 执行下列代码后的输出结果是
int [] numbers = {4, 2, -7, 5, 1, 6, 3};
int index = numbers[6] + numbers[numbers[4]];
System.out.println(numbers[numbers[index]]);
A. 1 B. 2 C. 3 D. 4
(3) 选出下面不能作为 void Med(int x)方法重载的声明。
A.void Med (double y) B.int Med (int y)
C.double Med (int x, int y) D.public float Med (float x)
(4) 设有下面的程序段:
char ct[] = {J, a, v, a};
String st= Java;
String tt = Java;
则下例表达式哪一个返回结果为真?
A. st==tt B. tt.equals(ct)
C. st.equals(tt) D. tt==ct
(5) Java提供接口的目的是 。
A. 实现多重继承 B. 便于事件的处理
C. 提供类的多种形式 D. 方便程序的实现
()下面代码那行将引起错误? 1 class Person {
#2 private String name;
#3 public Person(){}
#4 }
#5 public class Student extends Person {
#6 private String department;
#7 public Student() {}
#8 public String getValue(){ return name; }
#9 public static void main(String arg[]) {
#10 Person p = new Person();
#11 }
#12 }
A. 第3行第6行第7行第8行System.out.println(there is an exception);
}
}
static void oneMethod( ){
try{
anotherMethod( );
System.out.println(normal);
}
catch(ArithmeticException e){
System.out.println(there is an arithmeticexception);
}
finally{
System.out.println(in finally);
}
System.out.println(outside try block);
}
static void anotherMethod( ){
throw new NullPointerException( );
}
}
A. normal B. in finally
outside try block there is an exception
C. there is an arithmeticexception D. 程序无法处理该异常,异常由系统处理
in finally
there is an exception
试题二(12分, 每小题6分)
阅读下列程序, 把程序的输出结果写在答卷纸的对应栏内。
(1)【程序2.1】
public class
您可能关注的文档
最近下载
- 梁文涛《经济法基础》 第六章 其他税收法律制度.pptx VIP
- 贷款营销案例分析.pptx VIP
- 光色变奏-色彩基础知识与应用课件-高中美术人美版(2024)选修绘画.pptx VIP
- 3.1《百合花》 课件 (共43张PPT)2024-2025学年统编版高中语文必修上册.pptx VIP
- 2025年新人教版语文八年级上册全册教学设计.docx
- 如何培养员工的生产安全意识与技能.pptx VIP
- 刚果(金)某铜钴矿制取氢氧化钴的工艺研究.pdf VIP
- 梁文涛《经济法基础》 第五章 企业所得税、个人所得税法律制度.pptx VIP
- 患者的安全与护士的职业防护.pptx VIP
- 急性胰腺炎PPT(共30张PPT).pptx VIP
文档评论(0)