欢迎来到麦多课文档分享! | 帮助中心 海量文档,免费浏览,给你所需,享你所想!
麦多课文档分享
全部分类
  • 标准规范>
  • 教学课件>
  • 考试资料>
  • 办公文档>
  • 学术论文>
  • 行业资料>
  • 易语言源码>
  • ImageVerifierCode 换一换
    首页 麦多课文档分享 > 资源分类 > DOC文档下载
    分享到微信 分享到微博 分享到QQ空间

    【计算机类职业资格】计算机Java认证-分包、编译和解释Java代码、Java语句编程及答案解析.doc

    • 资源ID:1336859       资源大小:110KB        全文页数:16页
    • 资源格式: DOC        下载积分:5000积分
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    二维码
    微信扫一扫登录
    下载资源需要5000积分(如需开发票,请勿充值!)
    邮箱/手机:
    温馨提示:
    如需开发票,请勿充值!快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如需开发票,请勿充值!如填写123,账号就是123,密码也是123。
    支付方式: 支付宝扫码支付    微信扫码支付   
    验证码:   换一换

    加入VIP,交流精品资源
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    【计算机类职业资格】计算机Java认证-分包、编译和解释Java代码、Java语句编程及答案解析.doc

    1、计算机 Java认证-分包、编译和解释 Java代码、Java 语句编程及答案解析(总分:96.00,做题时间:90 分钟)一、B不定项选择题/B(总题数:26,分数:96.00)1.Which two import statements will allow for the import of the HashMap class? A. import java.util.HashMap; B. import java.util.*; C. import java.util.HashMap.*; D. import java.util.hashMap;(分数:4.00)A.B.C.D.2.Wh

    2、ich statement would designate that your file belongs in the package com. ocajexam.utilities? A. pack com.ocajexam.utilities; B. Package com.ocajexam.utilities.* C. package com.ocajexam.utilities.*; D. package com.ocajexam.utilities;(分数:4.00)A.B.C.D.3.Which of the following is the only Java package t

    3、hat is imported by default? A. java.awt B. java.lang C. java.util D. java.io(分数:4.00)A.B.C.D.4.What Java-related features are new to J2SE 5.0? A. Static imports B. package and import statements C. Autoboxing and unboxing D. The enhanced for loop(分数:4.00)A.B.C.D.5.The JCheckBox and JComboBox classes

    4、belong to which package? A. java.awt B. javax.awt C. java.swing D. javax.swing(分数:4.00)A.B.C.D.6.Which package contains the Java Collections Framework? A. java.io B. C. java.util D. java.utils(分数:4.00)A.B.C.D.7.The Java Basic I/O API contains what types of classes and interfaces? A. Internationaliz

    5、ation B. RMI, JDBC, and JNDI C. Data streams, serialization, and file system D. Collection API and data streams(分数:4.00)A.B.C.D.8.Which API provides a lightweight solution for GUI components? A. AWT B. Abstract Window Toolkit C. Swing D. AWT and Swing(分数:4.00)A.B.C.D.9.Consider the following illustr

    6、ation. What problem exists with the packaging? You may wish to reference Appendix G on the Unified Modeling Language (UML) for assistance.(分数:4.00)A.B.C.D.10.When apply naming conventions, which Java elements should start with a capital letter and continue on using the camel case convention? A. Clas

    7、s names B. Interface names C. Constant names D. Package names E. All of the above(分数:4.00)A.B.C.D.E.11.When instantiating an object with generics, should angle brackets, box brackets, parentheses, or double-quotes be used to enclose the generic type? Select the appropriate answer. A. List Integer a

    8、= new ArrayList Integer (); B. List Integer a = new ArrayList Integer (); C. List Integer a = new ArrayList Integer (); D. List “Integer“ a = new ArrayList “Integer“ ();(分数:4.00)A.B.C.D.12.When organizing the elements in a class, which order is preferred? A. Data members, methods, constructors B. Da

    9、ta members, constructors, methods C. Constructors, methods, data members D. Constructors, data members, methods E. Methods, constructors, data members(分数:4.00)A.B.C.D.E.13.Which usage represents a valid way of compiling a Java class? A. java MainClass.class B. javac MainClass C. javac MainClass.sour

    10、ce D. javac MainClass.java(分数:4.00)A.B.C.D.14.Which two command-line invocations of the Java interpreter return the version of the interpreter? A. java -version B. java -version C. java -version ProgramName D. java ProgramName -version(分数:4.00)A.B.C.D.15.Which two command-line usages appropriately i

    11、dentify the classpath? A. javac -cp/project/classes/MainClass.java B. javac -sp/project/classes/MainClass.java C. javac -classpath/project/classes/MainClass.java D. javac -classpaths/project/classes/MainClass.java(分数:4.00)A.B.C.D.16.Which command-line usages appropriately set a system property value

    12、? A. java -Dcom.ocajexam.propertyValue=003 MainClass B. java -d com.ocajexam.propertyValue=003 MainClass C. java -prop com.ocajexam.propertyValue=003 MainClass D. java -D:com.ocajexam.propertyValue=003 MainClass(分数:4.00)A.B.C.D.17.Which is not a type of statement? A. Conditional statement B. Assignm

    13、ent statement C. Iteration statement D. Propagation statement(分数:4.00)A.B.C.D.18.What type of statement is the following equation: y = (m*x)+b? A. Conditional statement B. Assignment statement C. Assertion statement D. Transfer of control statement(分数:4.00)A.B.C.D.19.Which statements correctly decla

    14、re boolean variables? A. Boolean isValid = true; B. boolean isValid = TRUE; C. boolean isValid = new Boolean(true); D. boolean isValid = 1;(分数:4.00)A.B.C.D.20.Given x is declared with a valid integer, which conditional statement will not compile? A. if(x = 0) System.out.println(“True Statement“); B.

    15、 if(x = 0) System.out.println(“False Statement“); C. if(x = 0) ; elseif(x = 1)System.out.println(“Valid Statement“); D. if(x = 0); else if(x = 1) else ;(分数:4.00)A.B.C.D.21.A switch statement works with which wrapper class/reference type(s)? A. Character B. Byte C. Short D. Int(分数:4.00)A.B.C.D.22.Whi

    16、ch of the following statements will not compile? A. if(true); B. if(true) C. if(true) ; D. if(true) ; E. if(true); ; F. All statements will compile.(分数:4.00)A.B.C.D.E.F.23.Given:public class Dinner public static void main (String args)boolean isKeeperFish = false;if (isKeeperFish = true) System.out.

    17、println(“Fish for dinner“); else System.out.println(“Take out for dinner“);What will be the result of the applications execution? A. Fish for dinner will be printed. B. Take out for dinner will be printed. C. A compilation error will occur.(分数:2.00)A.B.C.24.You need to update a value of a hash table

    18、 (that is, HashMap) where the primary key must equal a specified string. Which statements would you need to use in the implementation of this algorithm? A. Iteration statement B. Expression statement C. Conditional statement D. Transfer of control statement(分数:2.00)A.B.C.D.25.The for loop has been e

    19、nhanced in Java 5.0. Which is not a common term for the improved for loop? A. The for in loop B. The specialized for loop C. The for each loop D. The enhanced for loop(分数:2.00)A.B.C.D.26.Which keyword is part of a transfer of control statement? A. if B. return C. do D. assert(分数:2.00)A.B.C.D.计算机 Jav

    20、a认证-分包、编译和解释 Java代码、Java 语句编程答案解析(总分:96.00,做题时间:90 分钟)一、B不定项选择题/B(总题数:26,分数:96.00)1.Which two import statements will allow for the import of the HashMap class? A. import java.util.HashMap; B. import java.util.*; C. import java.util.HashMap.*; D. import java.util.hashMap;(分数:4.00)A. B. C.D.解析:HashMap

    21、 类可以直接通过 import java.util.HashMap或者使用通配符通过 import java.util.*;而导入。C 和 D不正确。C 不正确,因为这个答案是一条静态的 import语句,它导入 HashMap类的静态成员,而不是类本身。D 不正确,因为类名是大小写敏感的,所以类名 hashMap不等于 HashMap。2.Which statement would designate that your file belongs in the package com. ocajexam.utilities? A. pack com.ocajexam.utilities; B

    22、. Package com.ocajexam.utilities.* C. package com.ocajexam.utilities.*; D. package com.ocajexam.utilities;(分数:4.00)A.B.C.D. 解析:使用关键字 package是正确的,紧跟着是以点分隔的包名,后紧跟一个分号。A、B 和 C不正确。A不正确,因为单词 pack不是有效的关键字。B 不正确,因为 package语句必须以分号结尾,并且在package语句中不能使用星号。C 不正确,因为不能在 package语句中使用星号。3.Which of the following is

    23、the only Java package that is imported by default? A. java.awt B. java.lang C. java.util D. java.io(分数:4.00)A.B. C.D.解析:java.lang 包是所有类都默认导入的唯一包。A、C 和 D不正确。java.awt、java.util 和 java.io包中的类都不是默认导入的。4.What Java-related features are new to J2SE 5.0? A. Static imports B. package and import statements C.

    24、 Autoboxing and unboxing D. The enhanced for loop(分数:4.00)A. B.C. D. 解析:静态导入、自动装箱/拆箱和增强的 for循环都是 J2SE 5.0的新功能。B 不正确,因为基本的package和 import语句对于 J2SE 5.0不是新的。5.The JCheckBox and JComboBox classes belong to which package? A. java.awt B. javax.awt C. java.swing D. javax.swing(分数:4.00)A.B.C.D. 解析:属于 Swing

    25、API的组件通常以大写 J为前缀。因此,JCheckBox 和 JComboBox应该是 Java Swing API。的一部分,而不是 Java AWTAPI。Java Swing API 的基本包是 javax.swing。A、B 和 C不正确。A不正确,原因是包 java.awt不包括 JCheckBox和 JComboBox类,因为它们属于 Java Swing API。请注意,包 Java.awt包括 CheckBox类,而不包括 JCheckBox类。B 和 C不正确,因为包名 javax.awt和Java.swing不存在。6.Which package contains the

    26、 Java Collections Framework? A. java.io B. C. java.util D. java.utils(分数:4.00)A.B.C. D.解析:Java 集合框架是 java.util包中 Java实用工具 API的一部分。A、B 和 D不正确。A 不正确,因为Java基本的 I/O API的基本包名为 java.io,并且不包含 Java集合框架。B 不正确,因为 Java网络 API的基本包名为 ,同样不包括集合框架。D 不正确,因为没有名为 java.utils的包。7.The Java Basic I/O API contains what typ

    27、es of classes and interfaces? A. Internationalization B. RMI, JDBC, and JNDI C. Data streams, serialization, and file system D. Collection API and data streams(分数:4.00)A.B.C. D.解析:Java 基本的 I/O API包含了针对数据流、序列化和文件系统的类和接口。A、B 和 D不正确,因为国际化(il8n)、RMI、JDBC、JNDI 和集合框架不包括在基本 I/O的 API中。8.Which API provides a

    28、 lightweight solution for GUI components? A. AWT B. Abstract Window Toolkit C. Swing D. AWT and Swing(分数:4.00)A.B.C. D.解析:Swing API 为 GUI组件提供了轻量级的解决方案,这意味着 Swing API的类是用纯 Java代码构建的。A、B 和 D不正确。AWT 和抽象窗口工具是同一个,并且为 GUI组件提供了重量级的解决方案。9.Consider the following illustration. What problem exists with the pac

    29、kaging? You may wish to reference Appendix G on the Unified Modeling Language (UML) for assistance.(分数:4.00)A.B.C.D. 解析:COM.OCAJEXAM.UTILS 不满足正确的包命名规范。包名应该是小写的。包名的单词之间还应该有下划线。但是,ocajexam 中的单词是连接在 URL中的。因此,这里不包含下划线是可以接受的。包名应该是 com.orajexam.utils。A、B 和 C不正确。A 不正确,因为限制一个包内只能有一个类是可笑的,没有这样的限制。B 不正确,因为包可以

    30、并且经常与其他的包相关联。C 不正确,因为 com.ocajexam.backing beans符合正确的包命名规范。10.When apply naming conventions, which Java elements should start with a capital letter and continue on using the camel case convention? A. Class names B. Interface names C. Constant names D. Package names E. All of the above(分数:4.00)A. B.

    31、C.D.E.解析:类名和接口名应该以大写字母开头,并且继续使用驼峰命名规范。C 和 D不正确。C 不正确,因为常量名应该全部是以下划线分隔的大写字母。D 不正确,因为包名不包括大写字母,也不必遵守驼峰命名规范。11.When instantiating an object with generics, should angle brackets, box brackets, parentheses, or double-quotes be used to enclose the generic type? Select the appropriate answer. A. List Integ

    32、er a = new ArrayList Integer (); B. List Integer a = new ArrayList Integer (); C. List Integer a = new ArrayList Integer (); D. List “Integer“ a = new ArrayList “Integer“ ();(分数:4.00)A. B.C.D.解析:泛型使用尖括号。B、C 和 D不正确。泛型不能放入方括号、大括号和双引号中。12.When organizing the elements in a class, which order is preferre

    33、d? A. Data members, methods, constructors B. Data members, constructors, methods C. Constructors, methods, data members D. Constructors, data members, methods E. Methods, constructors, data members(分数:4.00)A.B. C.D.E.解析:在类中出现的元素的首选顺序是:首先出现数据成员,其次是构造函数,最后是方法。A、C、D 和E不正确。当以这些方式对元素进行排序时,不会造成任何功能或编译错误,这

    34、不是首选的。13.Which usage represents a valid way of compiling a Java class? A. java MainClass.class B. javac MainClass C. javac MainClass.source D. javac MainClass.java(分数:4.00)A.B.C.D. 解析:编译器通过 javac命令调用。当编译 Java类时,必须包括以 java为扩展名的主类的文件名。A、B 和 C不正确。A 不正确,因为 MainClass.class是已经编译过的字节码。B 不正确,因为 MainClass缺少

    35、java扩展名。C 不正确,因为 MainClass.source对任何类型的 Java文件都不是有效的名字。14.Which two command-line invocations of the Java interpreter return the version of the interpreter? A. java -version B. java -version C. java -version ProgramName D. java ProgramName -version(分数:4.00)A. B.C. D.解析:-version 标志应该用作第一个参数。应用程序将版本信息以

    36、适当的字符串返回到标准输出,然后立刻退出。第二个参数被忽略。B 和 D不正确。B 不正确,因为版本标志不允许使用双破折号。你可能在工具中看见过双破折号的标志,尤其是那些遵循 GNU许可证的标志。但是,双破折号不能应用于 Java解释器的版本标志中。D 不正确,因为版本标志必须作为第一个参数,否则它的功能将被忽略。15.Which two command-line usages appropriately identify the classpath? A. javac -cp/project/classes/MainClass.java B. javac -sp/project/classes

    37、/MainClass.java C. javac -classpath/project/classes/MainClass.java D. javac -classpaths/project/classes/MainClass.java(分数:4.00)A. B.C. D.解析:用于指定类路径的可选标志是-cp 或-classpath。B 和 D不正确,因为可选标志-sp 和-classpaths是无效的。16.Which command-line usages appropriately set a system property value? A. java -Dcom.ocajexam.

    38、propertyValue=003 MainClass B. java -d com.ocajexam.propertyValue=003 MainClass C. java -prop com.ocajexam.propertyValue=003 MainClass D. java -D:com.ocajexam.propertyValue=003 MainClass(分数:4.00)A. B.C.D.解析:属性设置是用于解释器的,而不是编译器。属性名必须被夹在-D 标志和等号之间。所期望的值应紧跟在等号之后。B、C 和 D不正确,因为-d、-prop 和-D:不是指定系统属性的有效方式。1

    39、7.Which is not a type of statement? A. Conditional statement B. Assignment statement C. Iteration statement D. Propagation statement(分数:4.00)A.B.C.D. 解析:没有传导语句(propagation statement)这样的语句。A、B 和 C不正确。条件、赋值和迭代是所有类型的语句。18.What type of statement is the following equation: y = (m*x)+b? A. Conditional sta

    40、tement B. Assignment statement C. Assertion statement D. Transfer of control statement(分数:4.00)A.B. C.D.解析:赋值语句将用于编写给定示例 y=(m*x)+b。A、C 和 D不正确。条件、断言和控制转换语句不用于赋值操作。19.Which statements correctly declare boolean variables? A. Boolean isValid = true; B. boolean isValid = TRUE; C. boolean isValid = new Bo

    41、olean(true); D. boolean isValid = 1;(分数:4.00)A. B.C. D.解析:这些语句正确声明了 boolean变量。请记住,boolean 基本数据类型的有效字面值只有 true和false。B 和 D不正确。B 不正确,因为 TRUE不是有效的字面值。D 是不正确的,因为你不能将 1赋值给boolean变量。20.Given x is declared with a valid integer, which conditional statement will not compile? A. if(x = 0) System.out.println(“

    42、True Statement“); B. if(x = 0) System.out.println(“False Statement“); C. if(x = 0) ; elseif(x = 1)System.out.println(“Valid Statement“); D. if(x = 0); else if(x = 1) else ;(分数:4.00)A.B.C. D.解析:该语句将无法编译。在 else和 if关键字之间没有空格,编译器将抛出类似于“Error: method elseif(boolean)not found.”的错误。A、B 和 D不正确。所有的这些条件语句都会编译

    43、成功。21.A switch statement works with which wrapper class/reference type(s)? A. Character B. Byte C. Short D. Int(分数:4.00)A. B. C. D.解析:switch 语句可以与 Character、Byte 和 Short封装类以及 Integer封装类一起工作。D 不正确。没有 Int封装类型这样的东西。这是一个陷阱问题。switch 语句可以与 int基本数据类型或 Integer封装类型一起工作。22.Which of the following statements wi

    44、ll not compile? A. if(true); B. if(true) C. if(true) ; D. if(true) ; E. if(true); ; F. All statements will compile.(分数:4.00)A.B.C.D.E.F. 解析:所有的语句都会编译。23.Given:public class Dinner public static void main (String args)boolean isKeeperFish = false;if (isKeeperFish = true) System.out.println(“Fish for d

    45、inner“); else System.out.println(“Take out for dinner“);What will be the result of the applications execution? A. Fish for dinner will be printed. B. Take out for dinner will be printed. C. A compilation error will occur.(分数:2.00)A. B.C.解析:由于只有一个等号(即赋值语句)用于 if语句中,isKeeperFish 变量被赋值为 true。B 和 C不正确。24

    46、.You need to update a value of a hash table (that is, HashMap) where the primary key must equal a specified string. Which statements would you need to use in the implementation of this algorithm? A. Iteration statement B. Expression statement C. Conditional statement D. Transfer of control statement

    47、(分数:2.00)A. B. C. D.解析:迭代、表达式和条件语句可以用来实现该算法。下面的代码段演示了通过编程使用这些语句来替换一个人左手小指上的戒指。这些语句的前面具有标识它们类型的注释。 import java.util.HashMap; public class HashMapExample public static void main(String args) HashMap String, String leftHand = new HashMap String, String (); leftHand.put(“Thumb“, null); leftHand.put(“Ind

    48、ex finger“, “Puzzle Ring“); leftHand.put(“Middle finger“, null); leftHand.put(“Ring finger“, “Engagement Ring“); leftHand.put(“Little finger“, “Pinky Ring“); / 迭代语句 for(String s : leftHand.keySet() / 条件语句 if(s.equals(“Little finger“) System.out.println(s + “had a“ + leftHand.get(s); / 表达式语句 leftHand.put(


    注意事项

    本文(【计算机类职业资格】计算机Java认证-分包、编译和解释Java代码、Java语句编程及答案解析.doc)为本站会员(吴艺期)主动上传,麦多课文档分享仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知麦多课文档分享(点击联系客服),我们立即给予删除!




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
    备案/许可证编号:苏ICP备17064731号-1 

    收起
    展开