【计算机类职业资格】计算机二级(JAVA)上机考试11及答案解析.doc

上传人:Iclinic170 文档编号:1337924 上传时间:2019-10-17 格式:DOC 页数:2 大小:34KB
下载 相关 举报
【计算机类职业资格】计算机二级(JAVA)上机考试11及答案解析.doc_第1页
第1页 / 共2页
【计算机类职业资格】计算机二级(JAVA)上机考试11及答案解析.doc_第2页
第2页 / 共2页
亲,该文档总共2页,全部预览完了,如果喜欢就下载吧!
资源描述

1、计算机二级(JAVA)上机考试 11 及答案解析(总分:-3.00,做题时间:90 分钟)1.基本操作题 下列程序中,定义了 3 个变量 l, s, b,类型分别为 long, short, byte 并赋了初始值,分别为-1,1,-1,要求对 l 做按位左移运算,对 s 做按位右移运算,对 b 做无符号按位右移运算,移动的位数均为 10 位。请将程序补充完整。 程序运行结果如下: -1024 0 -1 public class ex8_1 public static void main(String args) long l = -1; ; System.out.println(l); sh

2、ort s = 1; ; System.out.println(s); byte b = -1; ; System.out.println(b); (分数:-1.00)_2.简单应用题 请完成下列 Java 程序:使用 JTabbedPane 在窗口顶部建立一个图形标签,包含有两个标签窗格,一个使用简单表签(Label)显示欢迎信息,一个使用按钮和图标。注意:请勿改动 main()主方法和其他已有语句内容,仅在下划线处填入适当的语句。 程序运经结果如下: (分数:-1.00)_3.综合应用题 下面是一个 Applet 程序,其功能是有 2 个按钮,分别为 First 和 Second,以及一个

3、 Label构件。要求点击 First 时则能在 Label 中显示出 Command:First,而点击 Second 时则能显示出Command:Second,要求只能使用重载一次 actionPerformed()方法。请改正程序中的错误(有下划线的语句),使程序能输出正确的结果。程序运行结果如下: (分数:-1.00)_计算机二级(JAVA)上机考试 11 答案解析(总分:-3.00,做题时间:90 分钟)1.基本操作题 下列程序中,定义了 3 个变量 l, s, b,类型分别为 long, short, byte 并赋了初始值,分别为-1,1,-1,要求对 l 做按位左移运算,对 s

4、 做按位右移运算,对 b 做无符号按位右移运算,移动的位数均为 10 位。请将程序补充完整。 程序运行结果如下: -1024 0 -1 public class ex8_1 public static void main(String args) long l = -1; ; System.out.println(l); short s = 1; ; System.out.println(s); byte b = -1; ; System.out.println(b); (分数:-1.00)_正确答案:(l = 10 b = 10 )解析:本题主要考查位运算符。解题要点是熟悉左移,右移和无符号

5、右移运算的表达式。本题中,3 个空分别对应填上题目要求的运算表达式即可,注意无符号右移运算适合对负数进行右移运算。2.简单应用题 请完成下列 Java 程序:使用 JTabbedPane 在窗口顶部建立一个图形标签,包含有两个标签窗格,一个使用简单表签(Label)显示欢迎信息,一个使用按钮和图标。注意:请勿改动 main()主方法和其他已有语句内容,仅在下划线处填入适当的语句。 程序运经结果如下: (分数:-1.00)_正确答案:(jtp.addTab(“Icon“,icon,btn) jtp.addTab(“Welcome“,l) )解析:本题主要考查使用 JPanel 构件创建图形用户界

6、面。解题关键是熟悉 JTabbedPanel 类的使用方法,包括创建图形标签,并加入 Frame 容器中,以及在标签窗口中添加标签窗格,定制标签窗格等。本题中,第 1 个空,调用 addTab()方法将标签对象 l 加入 jtp 对象中;第 2 个空,调用 addTab()方法将 icon 和btn 的混合对象加入 jtp 对象中。3.综合应用题 下面是一个 Applet 程序,其功能是有 2 个按钮,分别为 First 和 Second,以及一个 Label构件。要求点击 First 时则能在 Label 中显示出 Command:First,而点击 Second 时则能显示出Command

7、Second,要求只能使用重载一次 actionPerformed()方法。请改正程序中的错误(有下划线的语句),使程序能输出正确的结果。程序运行结果如下: (分数:-1.00)_正确答案:(btn.addActionListener(this) btn.setActionCommand(“second“) l.setText(str) )解析:本题主要考查 Java 语言中高级事件 ActionEvent 和 AWT 基本构件 Label 的常用方法的使用。解题关键是熟练掌握动作事件 ActionEvent 和 Label 构件的常用方法。在本题中,第 1 处,明确注册的事件监听器是监听按钮的,而不是 Label 的;第 2 处,调用 ActionEvent 的 setActionCommand()方法改变了ActionCommand,使按下第二个按钮时显示 Command:second 而不是 Command: First。第 3 处,调用 Label的 setText()方法,而不是 Button 的方法。

展开阅读全文
相关资源
猜你喜欢
  • ANSI AAMI IEC TIR80001-2-3-2012 Application of risk management for IT Networks incorporating medical devices.Part 2-3 Guidance for wireless networks.pdf ANSI AAMI IEC TIR80001-2-3-2012 Application of risk management for IT Networks incorporating medical devices.Part 2-3 Guidance for wireless networks.pdf
  • ANSI AAMI IEC TIR80001-2-4-2012 Application of risk management for IT Networks incorporating medical devices.Part 2-4 General implementation guidance for healthcare delivery organi.pdf ANSI AAMI IEC TIR80001-2-4-2012 Application of risk management for IT Networks incorporating medical devices.Part 2-4 General implementation guidance for healthcare delivery organi.pdf
  • ANSI AAMI ISO 10993-1-2009 Biological evaluation of medical devices - Part 1 Evaluation and testing within a risk management process《医疗器械的生物学评价.第1部分 风险管理系统内的评价与测试》.pdf ANSI AAMI ISO 10993-1-2009 Biological evaluation of medical devices - Part 1 Evaluation and testing within a risk management process《医疗器械的生物学评价.第1部分 风险管理系统内的评价与测试》.pdf
  • ANSI AAMI ISO 10993-12-2007 Biological evaluation of medical devices - Part 12 Sample preparation and reference materials 《医疗装置的生物学评估.第12部分 样品制备和参考材料》.pdf ANSI AAMI ISO 10993-12-2007 Biological evaluation of medical devices - Part 12 Sample preparation and reference materials 《医疗装置的生物学评估.第12部分 样品制备和参考材料》.pdf
  • ANSI AAMI ISO 10993-12-2012 Biological evaluation of medical devices.Part 12 Sample preparation and reference materials.pdf ANSI AAMI ISO 10993-12-2012 Biological evaluation of medical devices.Part 12 Sample preparation and reference materials.pdf
  • ANSI AAMI ISO 10993-17-2002 Biological evaluation of medical devices - Part 17 Establishment of allowable limits for leachable substances《医疗器械的生物学评估.第17部分 可滤出物质允许极限值的确定》.pdf ANSI AAMI ISO 10993-17-2002 Biological evaluation of medical devices - Part 17 Establishment of allowable limits for leachable substances《医疗器械的生物学评估.第17部分 可滤出物质允许极限值的确定》.pdf
  • ANSI AAMI ISO 10993-5-2009 Biological evaluation of medical devices - Part 5 Tests for in vitro cytotoxicity《医疗器械的生物学评价.第5部分 体外细胞毒性试验》.pdf ANSI AAMI ISO 10993-5-2009 Biological evaluation of medical devices - Part 5 Tests for in vitro cytotoxicity《医疗器械的生物学评价.第5部分 体外细胞毒性试验》.pdf
  • ANSI AAMI ISO 10993-6-2007 Biological evaluation of medical devices - Part 6 Tests for local effects after implantation《医疗装置的生物学评估.第6部分 植入后局部效应用试验》.pdf ANSI AAMI ISO 10993-6-2007 Biological evaluation of medical devices - Part 6 Tests for local effects after implantation《医疗装置的生物学评估.第6部分 植入后局部效应用试验》.pdf
  • ANSI AAMI ISO 11137-2-2013 Sterilization of health care products.Radiation.Part 2 Establishing the sterilization dose《保健产品的灭菌.辐射.第2部分 杀菌剂量的确定》.pdf ANSI AAMI ISO 11137-2-2013 Sterilization of health care products.Radiation.Part 2 Establishing the sterilization dose《保健产品的灭菌.辐射.第2部分 杀菌剂量的确定》.pdf
  • 相关搜索
    资源标签

    当前位置:首页 > 考试资料 > 职业资格

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