OCJP 1Z0-808考题解析 题1--30

所有考题解析的下载地址:  链接:百度网盘 请输入提取码   提取码:pdj3

所有考题解析的预览:https://kdocs.cn/l/sckaemziW[金山文档] ocjp认证jdk1.8之1z0-808笔记.docx
 

题目难度分类

个人对于题目难度的分类:难度总共五星

不理解题:   ★★★★★

阅读理解题:  ★★★★

难点题: ★★★

套路题:      ★★★

基础题/送分题:     ★

题目错误题: ★

1--10(完)

1.

难度:基础题

解析:静态成员变量在程序运行中只会维护一份。非静态成员变量,每创建一个类就会维护一份。

2.

难度:基础题

解析:

  • String类型的API,字符串内容不能发生变化,一旦字符串内容发生变化,都要返回新的String。本题toLowerCase()和concat()都导致了原来的字符串内容变化了,所以不会在原来的对象上操作,而是返回新的String对象,本题没有接收返回值。
  • String.substring(beginIndex, endIndex): 这里下标的计算方式和数组一样,字符串的第一个元素的下标是0。

3.

难度:阅读理解题

解析:

  • 题目:

Which three are advantages(优势,有利条件) of the Java exception mechanism(机制)?

A.Improves(改善) the program(程序) structure(结构) because the error handling code is separated(分离的) from the normal program function

B.Provides a set of standard(标准的) exceptions that covers all the possible(可能的) errors

C.Improves the program structure because the programmer can choose where to handle

exceptions

D.Improves the program structure because exceptions must be handled in the method in Which they occurred

E.Allows the creation of new exceptions that are tailored to the particular program being created

  • 翻译:

A:改进程序结构,因为错误处理代码与正常程序功能分离

B:提供一组标准异常,覆盖所有可能的错误。

C:改进程序结构,因为程序员可以选择在何处处理异常。

D:改进程序结构,因为在它们发生的方法中必须处理异常。

E:允许创建特定于正在创建的特定程序的新异常。

  • 实际上:

B: 异常并没有覆盖所有的

D:异常可以抛出,不是必须处理

4.

难度:难点题

解析:line n1: 这个类没有无参的构造方法,所以编译失败

line n2:如果一个构造函数想调用另一个构造函数,需要是用this,不可以直接使用类名进行调用。

5.

难度:套路题

解析:选项B参数中的n3没有声明。

6.

难度:难点题

解析:jdk1.8新特征LocalData的API用法

7.

难度:基础题

解析:考查for循环体的格式。

8.

难度:难点题

解析:jdk1.8新特征LocalData的API用法

9.

难度:基础题

解析:B、D第二句代码,会使第一句代码无意义。E、判断不合理。等同如下

if(qty>80){

discount=0.2;

}else{

if(qty>=90){

discount=0.5;

}else{

discount=0;

}

}

10.

难度:难点题

解析:A和C有误。B能够编译。D将set方法设置为protect,降低了成员属性被任意修改的几率,符合封装的理念。

11--20(完)

11.

难度:基础题

解析:略

12.

难度:不理解题

解析:正确答案应该是D。indexOf()返回此列表中首次出现的指定元素的索引,或如果此列表不包含元素,则返回 -1。查找引用类型对象时,判断是内存地址。

13.

难度:不理解题

解析:我不是很理解选项A,super.r=r为什么错误。

14.

难度:阅读理解题

解析:loop construct(循环体)   optional(可选的)   terminates(终止)

正确答案应为A、B。

15.

难度:阅读理解题

解析:Which three statements are true about the structure(结构) of a Java class?

A. A class can have only one private constructor.

B. A method can have the same name as a field.

C. A class can have overloaded static methods.

D. A public class must have a main method.

E. The methods are mandatory(强制性的) components(组件) of a class.

F. The fields need not be initialized before use

正确答案应为B、C、F

16.

难度:不理解题

解析:记住答案。

17.

难度:基础题

解析:略

18.

难度:不理解题

解析:个人认为正确答案应该是C、D。

19.

难度:基础题

解析:== 判断引用类型是判断内存地址。String.equals()判断的是字符串的内容。

20.

难度:基础题

解析:考察静态和非静态成员变量。

21--30(完)

21.

难度:基础题

解析:正确答案应是D。Throwable常用的方法:

Throwable类

String

toString() 
   返回当前异常对象的完整类名+病态信息(getmessage()的返回值)。

Throwable类

String

getMessage() 
   回的是创建Throwable传入的字符串信息。

Throwable类

void

printStackTrace() 
   像控制台输出异常的栈信息。

22.

难度:难点题

解析:正确答案应是C。三元运算符嵌套格式,详见这篇博客

https://blog.csdn.net/u012316120/article/details/52122556

23.

难度:难点题

解析:集合和数组中有空值时,遍历时不会出错,如果拿空值去调用类的属性,就会报空指针异常。空值输出的是null。

24.

难度:基础题

解析:略

25

难度:基础题

解析:略

26.

难度:套路题

解析:此处while循环没有循环体,i++不在循环体内,所以是死循环。

难度:难点题

解析:记住:SercurityException和IllegalArgumentException是Java的异常类。

28.

难度:题目错误题

解析:上面的答案是错的。正确输出应为“A B C C ”。String的值是不可改变的,所有String的API一旦使值发生变化,都要返回一个新的String。 replace和concat方法调用者不会发生变化,变化的对象是返回值。

29.

难度:基础题

解析:B错误。一个try块可以捕获多种异常的类型,但是捕获的异常类型必须从小到大进行捕获,否则编译报错。

30.

难度:阅读理解题

解析:题意:一个方法被声明为三个参数。程序调用此方法只传递了两个参数。答案:A. Compilation fails.

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
Title: OCA: Oracle Certified Associate Java SE 8 Programmer I Study Guide: Exam 1Z0-808 Author: Jeanne Boyarsky, Scott Selikoff Length: 432 pages Edition: 1 Language: English Publisher: Sybex Publication Date: 2014-12-31 ISBN-10: 1118957407 ISBN-13: 9781118957400 Full coverage of functional programming and all OCA Java Programmer exam objectives OCA, Oracle Certified Associate Java SE 8 Programmer I Study Guide, Exam 1Z1-808 is a comprehensive study guide for those taking the Oracle Certified Associate Java SE 8 Programmer I exam (1Z1-808). With complete coverage of 100% of the exam objectives, this book provides everything you need to know to confidently take the exam. The release of Java 8 brought the language's biggest changes to date, and for the first time, candidates are required to learn functional programming to pass the exam. This study guide has you covered, with thorough functional programming explanation and information on all key topic areas Java programmers need to know. You'll cover Java inside and out, and learn how to apply it efficiently and effectively to create solutions applicable to real-world scenarios. * Work confidently with operators, conditionals, and loops * Understand object-oriented design principles and patterns * Master functional programming fundamentals Table of Contents Chapter 1 Java Building Blocks Chapter 2 Operators and Statements Chapter 3 Core Java APIs Chapter 4 Methods and Encapsulation Chapter 5 Class Design Chapter 6 Exceptions Appendix A Answers to Review Questions Appendix B Study Tips
OCA / OCP Practice Tests: Exam 1Z0-808 and Exam 1Z0-809 by Scott Selikoff English | 16 Mar. 2017 | ASIN: B06XQR7DVN | 600 Pages | AZW3 | 1.8 MB OCA/OCP Java SE 8 Programmer Practice Tests complements the Sybex OCA: Oracle Certified Associate Java SE 8 Programmer I Certification Study Guide and the OCP: Oracle Certified Professional Java SE 8 Programmer II Study Guide for exams 1Z0-808 and 1ZO-809 by providing last minute review of 100% of exam objectives. Get the advantage of over 1,000 expert crafted questions that not only provide the answer, but also give detailed explanations. You will have access to unique practice questions that cover all 21 objective domains in the OCA/OCP exams in the format you desire–test questions can also be accessed via the Sybex interactive learning environment. Two additional practice exams will ensure that you are ready for exam day. Whether you have studied with Sybex study guides for your OCA/OCP or have used another brand, this is your chance to test your skills. Access to all practice questions online with the Sybex interactive learning environment Over 1,000 unique practice questions and 2 practice exams include expert explanations Covers 100% of all 21 OCA/OCP objective domains for Exams 1Z0-809 and 1Z0-809 Studying the objectives are one thing, but diving deeper and uncovering areas where further attention is needed can increase your chance of exam day success. Full coverage of all domains shows you what to expect on exam day, and accompanying explanations help you pinpoint which objectives deserve another look.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

奔雷手文泰莱

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值