【计算机类职业资格】二级JAVA机试-23及答案解析.doc

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

1、二级 JAVA 机试-23 及答案解析(总分:100.00,做题时间:90 分钟)一、1基本操作题(总题数:1,分数:33.00)1.System.out.println(i+ “ ! =“ + 1Factorial);(分数:33.00)_二、2简单应用题(总题数:1,分数:33.00)2.System.out.println(“Number of days:“+ nNumOfDays);(分数:33.00)_三、3综合应用题(总题数:1,分数:34.00)3.下面是一个 Applet 程序,其功能是建立一个图形用户界面的窗口,包括一个文本显示区和一个按钮,点击按钮,可以在文本区已有的文本基

2、础上追加显示 10 条“Welcome to the NCR Examination!”信息,并且文本区由滚动条控制文本的上下滚动。请改正程序中的错误(有下划线的语句),使程序能输出正确的结果。注意:不改动程序的结构,不得增行或删行。程序运行结果如下:(分数:34.00)_二级 JAVA 机试-23 答案解析(总分:100.00,做题时间:90 分钟)一、1基本操作题(总题数:1,分数:33.00)1.System.out.println(i+ “ ! =“ + 1Factorial);(分数:33.00)_正确答案:(1Factorial=1j=i1Factorial*=j)解析:解析本题主

3、要考查 for 循环语句和简单的数学计算。解题要点是熟练掌握 for 循环语句,会解决一些简单的数学问题,熟悉求阶乘的算法,并用程序实现这一算法。本题中,第 1 个空,要对 1Factorial 变量进行初始化,因为需要计算 1 到 10 一共 10 个数的阶乘,所以最外层循环共执行 10 次,每次都需要将1Factorial 重新初始化为 1:第 2 个空,内层循环实现某个数的阶乘,因此循环变量的上界应该是 i=i;第3 个空,阶乘算法的公式,做累乘。二、2简单应用题(总题数:1,分数:33.00)2.System.out.println(“Number of days:“+ nNumOfD

4、ays);(分数:33.00)_正确答案:(nMonth0 | nMonth12(nYear%4 =0)&!(nYear%100 = 0) | (nYear%400 = 0)解析:解析本题主要考查 swing 图形用户界面设计和 case 语句的简单应用。解题关键是会用 swing 的容器面板构造对话框,熟悉判断闰年的条件语句的设计,判断输入是否符合程序要求的条件语句设计,case 语句的设计。本题中,第 1 个空,判断输入的月份值应该在 1 到 12 月之间,否则给出提示信息并退出;第 2 个空,闰年的判断,将题干中的提示用代码实现。三、3综合应用题(总题数:1,分数:34.00)3.下面是

5、一个 Applet 程序,其功能是建立一个图形用户界面的窗口,包括一个文本显示区和一个按钮,点击按钮,可以在文本区已有的文本基础上追加显示 10 条“Welcome to the NCR Examination!”信息,并且文本区由滚动条控制文本的上下滚动。请改正程序中的错误(有下划线的语句),使程序能输出正确的结果。注意:不改动程序的结构,不得增行或删行。程序运行结果如下:(分数:34.00)_正确答案:(jtp.setText(jtp.getText() + “ Welcome to the NCR Examination!/n“)cp.add(BorderLayout.SOUTH,jb)

6、frm.getContentPane().add(obj10_3)解析:解析本题主要考查 Applet 和 swing 结合进行图形用户界面设计的综合应用。解题关键是掌握 swing 的基本构件 JTextPanel, JButton,JScrollPanel 的用法,掌握 BorderLayout 布局管理器的使用方法,以及熟练掌握最基本的对象概念。本题中,第 1 处, JTextPanel 的 2 个基本的方法,setText()和 getText()的功能,熟悉这 2 个功能,则很容易就能将错误改正;第 2 处,应该是通过 BorderLayout 布局管理器在窗口的最下方添加一个 JBuRon 对象,需要清楚程序中每个对象所对应的类;第 3 处,应该是将类 ex10_3 的对象。obj10_3 加入容器中,而不是把类作为参数传递给 add()方法。

展开阅读全文
相关资源
猜你喜欢
  • BS DD IEC PAS 61249-3-1-2007 Materials for printed boards and other interconnecting structures - Copper-clad laminates for flexible boards (adhesive and non-adhesive types)《印制板和其他互.pdf BS DD IEC PAS 61249-3-1-2007 Materials for printed boards and other interconnecting structures - Copper-clad laminates for flexible boards (adhesive and non-adhesive types)《印制板和其他互.pdf
  • BS DD IEC PAS 61249-6-3-2011 Specification for finished fabric woven from  E  glass for printed boards《印制板 E 玻璃制成的成品纤维织品规范》.pdf BS DD IEC PAS 61249-6-3-2011 Specification for finished fabric woven from E glass for printed boards《印制板 E 玻璃制成的成品纤维织品规范》.pdf
  • BS DD IEC PAS 61280-2-10-2003 Fibre optic communication subsystem test procedures - Digital systems - Time-resolved chirp and alpha-factor measurement of laser transmitters《纤维光学通信子.pdf BS DD IEC PAS 61280-2-10-2003 Fibre optic communication subsystem test procedures - Digital systems - Time-resolved chirp and alpha-factor measurement of laser transmitters《纤维光学通信子.pdf
  • BS DD IEC PAS 62282-6-150-2011 Fuel cell technologies Micro fuel cell power systems Safety Water reactive (UN Division 4 3) compounds in indirect PEM fuel cells《燃料电池技术 微型燃料电池动力系统 安.pdf BS DD IEC PAS 62282-6-150-2011 Fuel cell technologies Micro fuel cell power systems Safety Water reactive (UN Division 4 3) compounds in indirect PEM fuel cells《燃料电池技术 微型燃料电池动力系统 安.pdf
  • BS DD IEC PAS 62326-14-2010 Printed boards Device embedded substrate Terminology  reliability  design guide《印刷电路板 设备嵌入式基底 术语 可靠性 设计指南》.pdf BS DD IEC PAS 62326-14-2010 Printed boards Device embedded substrate Terminology reliability design guide《印刷电路板 设备嵌入式基底 术语 可靠性 设计指南》.pdf
  • BS DD IEC PAS 62326-7-1-2007 Performance guide for single- and double-sided flexible printed wiring boards《单面和双面柔性印制布线电路板的性能指南》.pdf BS DD IEC PAS 62326-7-1-2007 Performance guide for single- and double-sided flexible printed wiring boards《单面和双面柔性印制布线电路板的性能指南》.pdf
  • BS DD IEC PAS 62435-2006 Electronic components - Long duration storage of electronic components - Guidance for implementation《电子部件 电子元件的长期存储 执行指南》.pdf BS DD IEC PAS 62435-2006 Electronic components - Long duration storage of electronic components - Guidance for implementation《电子部件 电子元件的长期存储 执行指南》.pdf
  • BS DD IEC PAS 62437-2006 Radio disturbance characteristics for the protection of receivers used on board vehicles boats and on devices - Limits and methods of measurement - Specifi.pdf BS DD IEC PAS 62437-2006 Radio disturbance characteristics for the protection of receivers used on board vehicles boats and on devices - Limits and methods of measurement - Specifi.pdf
  • BS DD IEC PAS 62443-3-2008 Security for industrial process measurement and control - Network and system security《工业过程的测量和控制安全 网络和系统安全》.pdf BS DD IEC PAS 62443-3-2008 Security for industrial process measurement and control - Network and system security《工业过程的测量和控制安全 网络和系统安全》.pdf
  • 相关搜索

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

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