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

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

1、计算机二级 JAVA-154及答案解析(总分:100.00,做题时间:90 分钟)一、1基本操作题(总题数:1,分数:30.00)1.本题程序功能是打印 19 的乘法表。请将下述程序补充完整(注意:不得改动程序的结构,不得增行或删行)。 public class basic public static void main(String args) _; for(i = i; _; i+) for(j = i;_; j+) System.out.print(i + “x“ + j + “=“ +i *j +“); System.out.println(); (分数:30.00)_二、2简单应用题

2、总题数:1,分数:40.00)2.注意:下面出现的“考生文件夹”均为%USER%。 在考生文件夹中存有文件名为 Java_2.java文件,本题功能是在 1n 之间的自然数中,每次抽取 k个数字来抽奖,计算中奖几率的算法为 n*(n-1)*(n-2)*(n-k+1)/1*2*3*k 请完善 Java_2.java文件,并进行调试,使程序先显示输入窗口如下: (分数:40.00)_三、3综合应用题(总题数:1,分数:30.00)3.本题程序是一个 Applet应用程序,功能是更改显示的图片。页面中有一个按钮“改变图形”,单击该按钮,面板中显示的图片改变;继续单击,图片继续改变。请将下述程序补充

3、完整(注意:不得改动程序的结构,不得增行或删行)。 import java.applet.*; import java.awt.*; import java.awt.event.*; public class advance extends Applet implements ActionListener int n = 0; Image im1,im2,showim; Button bn = new Button(“改变图形“); public void init() add (bn); _; im1 = getImage(getCodeBase(),“advance_1.jpg“); im

4、2 = getImage(getCodeBase(),“advance_2.jpg“); bn.addActionListener ( this ); showim = im2; public void actionPerformed(ActionEvent e) _; if (e.getActionCommand ()= “改变“ ) if(n%2 = 0) showim = im1; n+; else showim = im2; n+; _; public void paint (Graphics g) g.drawImage (showim,0,0,this); (分数:30.00)_计

5、算机二级 JAVA-154答案解析(总分:100.00,做题时间:90 分钟)一、1基本操作题(总题数:1,分数:30.00)1.本题程序功能是打印 19 的乘法表。请将下述程序补充完整(注意:不得改动程序的结构,不得增行或删行)。 public class basic public static void main(String args) _; for(i = i; _; i+) for(j = i;_; j+) System.out.print(i + “x“ + j + “=“ +i *j +“); System.out.println(); (分数:30.00)_正确答案:()解析:

6、int i,j。 i10。 j=i。二、2简单应用题(总题数:1,分数:40.00)2.注意:下面出现的“考生文件夹”均为%USER%。 在考生文件夹中存有文件名为 Java_2.java文件,本题功能是在 1n 之间的自然数中,每次抽取 k个数字来抽奖,计算中奖几率的算法为 n*(n-1)*(n-2)*(n-k+1)/1*2*3*k 请完善 Java_2.java文件,并进行调试,使程序先显示输入窗口如下: (分数:40.00)_正确答案:()解析:JOptionPane input Integer lotteryOdds解析 输入对话框,需填入 JOptionPane;需转换成整数的字符串

7、变量,需填入 input;将字符串 input转换成整数的类方法所属于的类,需填入 Integer;屏幕打印内容,需填入 IotteryOdds。三、3综合应用题(总题数:1,分数:30.00)3.本题程序是一个 Applet应用程序,功能是更改显示的图片。页面中有一个按钮“改变图形”,单击该按钮,面板中显示的图片改变;继续单击,图片继续改变。请将下述程序补充完整(注意:不得改动程序的结构,不得增行或删行)。 import java.applet.*; import java.awt.*; import java.awt.event.*; public class advance extend

8、s Applet implements ActionListener int n = 0; Image im1,im2,showim; Button bn = new Button(“改变图形“); public void init() add (bn); _; im1 = getImage(getCodeBase(),“advance_1.jpg“); im2 = getImage(getCodeBase(),“advance_2.jpg“); bn.addActionListener ( this ); showim = im2; public void actionPerformed(ActionEvent e) _; if (e.getActionCommand ()= “改变“ ) if(n%2 = 0) showim = im1; n+; else showim = im2; n+; _; public void paint (Graphics g) g.drawImage (showim,0,0,this); (分数:30.00)_正确答案:()解析:bn.setActionCommand(“改变“)。 Graphics g=getGraphics()。 update(g)。

展开阅读全文
相关资源
猜你喜欢
  • BS EN 14458-2004 Personal eye-equipment - Faceshields and visors for use with firefighters and high performance industrial safety helmets used by firefighters ambulance and emergen.pdf BS EN 14458-2004 Personal eye-equipment - Faceshields and visors for use with firefighters and high performance industrial safety helmets used by firefighters ambulance and emergen.pdf
  • BS EN 14459-2015 Safety and control devices for burners and appliances burning gaseous or liquid fuels Control functions in electronic systems Methods for classification and assess.pdf BS EN 14459-2015 Safety and control devices for burners and appliances burning gaseous or liquid fuels Control functions in electronic systems Methods for classification and assess.pdf
  • BS EN 14462-2015 Surface treatment equipment Noise test code for surface treatment equipment including its ancillary handling equipment Accuracy grades 2 and 3《表面处理设备 包括其辅助操作装置在内的表.pdf BS EN 14462-2015 Surface treatment equipment Noise test code for surface treatment equipment including its ancillary handling equipment Accuracy grades 2 and 3《表面处理设备 包括其辅助操作装置在内的表.pdf
  • BS EN 14465-2004 Textiles - Upholstery fabrics - Specification and methods of test《纺织品 家具装饰织物 规范和试验方法》.pdf BS EN 14465-2004 Textiles - Upholstery fabrics - Specification and methods of test《纺织品 家具装饰织物 规范和试验方法》.pdf
  • BS EN 14468-1-2015 Table tennis Table tennis tables functional and safety requirements test methods《乒乓球 乒乓球台功能、安全要求和试验方法》.pdf BS EN 14468-1-2015 Table tennis Table tennis tables functional and safety requirements test methods《乒乓球 乒乓球台功能、安全要求和试验方法》.pdf
  • BS EN 14468-2-2015 Table tennis Posts for net assemblies Requirements and test methods《乒乓球 球网组件孔隙 要求和试验方法》.pdf BS EN 14468-2-2015 Table tennis Posts for net assemblies Requirements and test methods《乒乓球 球网组件孔隙 要求和试验方法》.pdf
  • BS EN 14469-1-2004 Pigments and extenders - Testing of colouring materials in plasticized polyvinyl chloride (PVC-P) - Composition and preparation of basic mixtures《颜料和填充剂 增塑聚氯乙烯(P.pdf BS EN 14469-1-2004 Pigments and extenders - Testing of colouring materials in plasticized polyvinyl chloride (PVC-P) - Composition and preparation of basic mixtures《颜料和填充剂 增塑聚氯乙烯(P.pdf
  • BS EN 14469-2-2004 Pigments and extenders - Testing of colouring materials in plasticized polyvinyl chloride (PVC-P) - Preparation of test specimens《颜料和填充剂 增塑聚氯乙烯(PVC-P)中着色剂的检验 试样的.pdf BS EN 14469-2-2004 Pigments and extenders - Testing of colouring materials in plasticized polyvinyl chloride (PVC-P) - Preparation of test specimens《颜料和填充剂 增塑聚氯乙烯(PVC-P)中着色剂的检验 试样的.pdf
  • BS EN 14469-3-2004 Pigments and extenders - Testing of colouring materials in plasticized polyvinyl chloride (PVC-P) - Determination of the relative tinting strength of white pigme.pdf BS EN 14469-3-2004 Pigments and extenders - Testing of colouring materials in plasticized polyvinyl chloride (PVC-P) - Determination of the relative tinting strength of white pigme.pdf
  • 相关搜索

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

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