没有合适的资源?快使用搜索试试~ 我知道了~
(Sun Certified Java Programmer)SCJP 考试题及答案(最全)
4星 · 超过85%的资源 需积分: 8 18 下载量 122 浏览量
2011-12-04
14:35:26
上传
评论
收藏 1.58MB DOC 举报
温馨提示
试读
64页
Sun Certified Java Programmer 历年考试题及答案
资源推荐
资源详情
资源评论
Exam : 310-035
Title : Sun Certified Programmer for Java 2
Platform 1.4
Ver : 06.20.06
310-035
QUESTION 1:
Given:
1. public class Test {
2. public static void main(String args[]) {
3. class Foo {
4. public int i = 3;
5. }
6. Object o = (Object)new Foo();
7. Foo foo = (Foo)o;
8. System.out.println("i = " + foo.i);
9. }
10. }
What is the result?
A. i = 3
B. Compilation fails.
C. A ClassCastException is thrown at line 6.
D. A ClassCastException is thrown at line 7.
Answer: A
QUESTION 2:
Which two cause a compiler error? (Choose two)
A. float[] = new float(3);
B. float f2[] = new float[];
C. float[] f1 = new float[3];
D. float f3[] = new float[3];
E. float f5[] = { 1.0f, 2.0f, 2.0f };
F. float f4[] = new float[] { 1.0f. 2.0f. 3.0f};
Answer: A, B
The F. statement is incorrect. The float numbers should be separated with commas and not
dots.
QUESTION 3:
Given:
11. int i =1,j =10;
12. do {
13. if(i++> --j) {
14. continue;
15. }
Actualte s ts . com - The Po w er of Kno w ing
310-035
16. } while (i <5);
17. System.out.println("i = " +i+ "and j = "+j); What is the result?
A. i = 6 and j = 5
B. i = 5 and j = 5
C. i = 6 and j = 5
D. i = 5 and j = 6
E. i = 6 and j = 6
Answer: D
QUESTION 4:
Given:
1. class Test {
2. private Demo d;
3. void start() {
4. d = new Demo();
5. this.takeDemo(d);
6. }
7.
8. void takeDemo(Demo demo) {
9. demo = null;
10. demo = new Demo();
11. }
12. }
When is the Demo object, created on line 3, eligible for garbage collection?
A. After line 5.
B. After line 9.
C. After the start() method completes.
D. When the takeDemo() method completes.
E. When the instance running this code is made eligible for garbage collection.
Answer: E
QUESTION 5:
Given:
1. interface Animal {
2. void soundOff();
3. }
4.
5. class Elephant implements Animal {
6. public void soundOff() {
Actualte s ts . com - The Po w er of Kno w ing
310-035
7. System.out.println("Trumpet");
8. }
9. }
10.
11. class Lion implements Animal {
12. public void soundOff() {
13. System.out.println("Roar");
14. }
15. }
16.
17. class Alpha1 {
18. static Animal get( String choice ) {
19. if ( choice.equalsIgnoreCase( "meat eater" )) {
20. return new Lion();
21. } else {
22. return new Elephant();
23. }
24. }
25. }
Which compiles?
A. new Animal().soundOff();
B. Elephant e = new Alpha1();
C. Lion 1 = Alpha.get("meat eater");
D. new Alpha1().get("veggie").soundOff();
Answer: D
QUESTION 6:
Which statement is true?
A. Memory is reclaimed by calling Runtime.gc().
B. Objects are not collected if they are accessible from live threads.
C. Objects that have finalize() methods are never garbage collected.
D. Objects that have finalize() methods always have their finalize() methods called before
the program ends.
E. An OutOfMemory error is only thrown if a single block of memory cannot be found
that is large enough for a particular requirement.
Answer: B
QUESTION 7:
Given:
1. class A {
Actualte s ts . com - The Po w er of Kno w ing
剩余63页未读,继续阅读
资源评论
- sntylts2013-03-17这个资源在现在不知道能不能涵盖到许多部分了,因为现在考试叫OCJP,考试代号为LZ0-851了,这个应该是以前的版本,不过还是谢谢了
- johnxy2013-09-07还可以,可以参考一下!
ranko
- 粉丝: 13
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Flume进阶-自定义拦截器jar包
- Dubins曲线算法讲解和在运动规划中的使用.pdf
- 上市公司-股票性质数据-工具变量(民企、国企、央企)2003-2022年.dta
- 上市公司-股票性质数据-工具变量(民企、国企、央企)2003-2022年.xlsx
- Reeds+Shepp曲线算法讲解和实现.pdf
- 毕业设计基于SpringBoot+MyBatisPlus+MySQL+Vue的外卖配送信息系统源代码+数据库
- 词向量(Word Embeddings)是自然语言处理(NLP)领域的一种重要技术.txt
- Surfer,线性函数
- MyBatis 的动态 SQL 是其核心特性之一.txt
- 时代的sdddsddsddsd
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功