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

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

1、二级 JAVA机试 71及答案解析(总分:100.00,做题时间:90 分钟)一、B1基本操作题/B(总题数:1,分数:30.00)1.下面的程序是用 do_while语句计算 10的阶乘。请在程序的每条横线处填写一个语句,使程序的功能完整。 注意:请勿改动 main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。 public class DoWhileLoop public static void main(_) int n=10; long result=1; do _ _ System. out.println( “10的阶乘为: “+result); (分数:30.00)_

2、二、B2简单应用题/B(总题数:1,分数:40.00)2.请完成下列 Java程序。程序的执行结果是生成一个具有一个 TextField类型的对象 in、Button 类型的对象 btn和 Label类型的对象 out图形用户界面,程序的功能是计算用户输入数的平方。 (分数:40.00)_三、B3综合应用题/B(总题数:1,分数:30.00)3.下面是一个 Apple(程序,程序的功能是在 Applet显示区内画一个动态的、多维的绿色椭圆环。本题主要是通过数学方法 sin(),cos()画出一个圆环。请改正程序中的错误(有下划线的语句),使程序能输出正确的结果。 注意:不改动程序的结构,不得增

3、行或删行。程序的执行结果: (分数:30.00)_二级 JAVA机试 71答案解析(总分:100.00,做题时间:90 分钟)一、B1基本操作题/B(总题数:1,分数:30.00)1.下面的程序是用 do_while语句计算 10的阶乘。请在程序的每条横线处填写一个语句,使程序的功能完整。 注意:请勿改动 main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。 public class DoWhileLoop public static void main(_) int n=10; long result=1; do _ _ System. out.println( “10的阶乘为

4、 “+result); (分数:30.00)_正确答案:()解析:String args result*=n-; while(n=1); 解析 本题主要考查 main()主方法的使用、while循环语句的用法。解答本题的关键是熟练掌握 main()主方法的使用、while 循环语句的用法。在本题中,String args的作用是声明字符数组 args,result*=n-;语句的作用是获得 n的阶乘并赋值给变量 result。二、B2简单应用题/B(总题数:1,分数:40.00)2.请完成下列 Java程序。程序的执行结果是生成一个具有一个 TextField类型的对象 in、Button

5、类型的对象 btn和 Label类型的对象 out图形用户界面,程序的功能是计算用户输入数的平方。 (分数:40.00)_正确答案:()解析:new AppFrame(); DoubleparseDouble(s); 解析 本题主要考查 Java语言中类、对象的概念以及包装类 Double的用法。解答本题的关键是熟练掌握类、对象的概念。在本题中,new AppFrame();语句的功能是调用 AppFrame类的构造方法生成一个对象,语句 DoubleparseDouble(s);的功能是将从文本框获得的字符型数据转化成 double型数据。三、B3综合应用题/B(总题数:1,分数:30.00

6、)3.下面是一个 Apple(程序,程序的功能是在 Applet显示区内画一个动态的、多维的绿色椭圆环。本题主要是通过数学方法 sin(),cos()画出一个圆环。请改正程序中的错误(有下划线的语句),使程序能输出正确的结果。 注意:不改动程序的结构,不得增行或删行。程序的执行结果: (分数:30.00)_正确答案:()解析:g.setColor(Colorgreen); pinit(); Systemexit(0); 解析 本题主要考查 Java Applet程序的编写、for 循环语句和 Java程序事件处理机制。解答本题的关键是熟练掌握 Java Applet程序的编写和 Java程序事件处理机制的知识。在本题中,g.setColor(Color.green);语句的功能是设置所画图形的颜色, p.init();语句的功能是初始化小程序 Applet,Systemexit(0);语句的功能是关闭窗口,结束小程序的运行。

展开阅读全文
相关资源
猜你喜欢
  • DIN EN 1649-2004 AIDC technologies - Operational aspects affecting the reading of bar code symbols German version EN 1649 2004《AIDC技术 影响条形码符号的读取的操作方法》.pdf DIN EN 1649-2004 AIDC technologies - Operational aspects affecting the reading of bar code symbols German version EN 1649 2004《AIDC技术 影响条形码符号的读取的操作方法》.pdf
  • DIN EN 1650-2013 Chemical disinfectants and antiseptics - Quantitative suspension test for the evaluation of fungicidal or yeasticidal activity of chemical disinfectants and antiset.pdf DIN EN 1650-2013 Chemical disinfectants and antiseptics - Quantitative suspension test for the evaluation of fungicidal or yeasticidal activity of chemical disinfectants and antiset.pdf
  • DIN EN 1652-1998 Copper and copper alloys - Plate sheet strip and circles for general purposes German version EN 1652 1997《铜和铜合金 一般用途的板材、薄板、带材和圆材 德文版本 EN 1652 1997》.pdf DIN EN 1652-1998 Copper and copper alloys - Plate sheet strip and circles for general purposes German version EN 1652 1997《铜和铜合金 一般用途的板材、薄板、带材和圆材 德文版本 EN 1652 1997》.pdf
  • DIN EN 1653-2000 Copper and copper alloys - Plate sheet and circles for boilers pressure vessels and hot water storage units (includes amendment A1 2000) German version EN 1653 199.pdf DIN EN 1653-2000 Copper and copper alloys - Plate sheet and circles for boilers pressure vessels and hot water storage units (includes amendment A1 2000) German version EN 1653 199.pdf
  • DIN EN 1654-1998 Copper and copper alloys - Strip for springs and connectors German version EN 1654 1997《铜和铜合金 弹簧和连接器用带材》.pdf DIN EN 1654-1998 Copper and copper alloys - Strip for springs and connectors German version EN 1654 1997《铜和铜合金 弹簧和连接器用带材》.pdf
  • DIN EN 1655-1997 Copper and copper alloys - Declarations of conformity German version EN 1655 1997《铜和铜合金 符合性公示》.pdf DIN EN 1655-1997 Copper and copper alloys - Declarations of conformity German version EN 1655 1997《铜和铜合金 符合性公示》.pdf
  • DIN EN 1656 Berichtigung 1-2010 Chemical disinfectants and antiseptics - Quantitative suspension test for the evaluation of bactericidal activity of chemical disinfectants and antid.pdf DIN EN 1656 Berichtigung 1-2010 Chemical disinfectants and antiseptics - Quantitative suspension test for the evaluation of bactericidal activity of chemical disinfectants and antid.pdf
  • DIN EN 1657-2016 Chemical disinfectants and antiseptics - Quantitative suspension test for the evaluation of fungicidal or yeasticidal activity of chemical disinfectants and antisea.pdf DIN EN 1657-2016 Chemical disinfectants and antiseptics - Quantitative suspension test for the evaluation of fungicidal or yeasticidal activity of chemical disinfectants and antisea.pdf
  • DIN EN 1659-1997 In vitro diagnostic systems - Culture media for microbiology - Terms and definitions German version EN 1659 1996《体外诊断系统 微生物培养基 术语定义》.pdf DIN EN 1659-1997 In vitro diagnostic systems - Culture media for microbiology - Terms and definitions German version EN 1659 1996《体外诊断系统 微生物培养基 术语定义》.pdf
  • 相关搜索
    资源标签

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

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