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

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

1、二级 JAVA 机试-121 及答案解析(总分:100.00,做题时间:90 分钟)一、1基本操作题(总题数:1,分数:33.00)1._(分数:33.00)_二、2简单应用题(总题数:1,分数:33.00)2.System.out.prinfln(“i=“+i+“s=“+s);(分数:33.00)_三、3综合应用题(总题数:1,分数:34.00)3.下面是一个 Applet 程序,其功能是统计输入字符串中的每个字符在该串中出现的次数。要求,窗口中有一个文本框作为输入,一个按钮,点击则进行统计,统计结果以图形方式输出。请改正程序中的错误(有下画线的语句),使程序能输出正确的结果。注意:不改动程

2、序的结构,不得增行或删行。import java.awt.*;import java.applet.*;import java.1ang*;public class exl3_3 extends Appletprivate TextField tf;private Button btn;public void init()tf=new TextField(25);add(tf);btn=new Bunon(“统计“);add(btn);resize(250,200);pubhc void paint(Graphics g)Stling str=tf.genText();shon cnt=new

3、 shon65536;int i;int n = 50;for(i=0;i65536;i+)cati=0;for(i=0;istr.length();i+)cnti+;for(i=0;i65536;i+)/对数组 Cnt进行初始化if(cnti=0)g.drawString(i+“出现“+cnti+“次“,50,n);n+=20;public boolean action(Eyent e,Object o)if(o=“统计“)repaint();return true;elsereturn false;ex13_3.htmlHTMLHEADTITLEex13_3/TITLE/HEADBODYa

4、pplet code=“ex13_3.class“width=800 height=400/applet/BODY/HTML(分数:34.00)_二级 JAVA 机试-121 答案解析(总分:100.00,做题时间:90 分钟)一、1基本操作题(总题数:1,分数:33.00)1._(分数:33.00)_正确答案:(int a=Integef.parseInt(s);a=a*3+1;catch(Exception e)解析:二、2简单应用题(总题数:1,分数:33.00)2.System.out.prinfln(“i=“+i+“s=“+s);(分数:33.00)_正确答案:(sign=-sign

5、Math.abs(t)0.001)解析:三、3综合应用题(总题数:1,分数:34.00)3.下面是一个 Applet 程序,其功能是统计输入字符串中的每个字符在该串中出现的次数。要求,窗口中有一个文本框作为输入,一个按钮,点击则进行统计,统计结果以图形方式输出。请改正程序中的错误(有下画线的语句),使程序能输出正确的结果。注意:不改动程序的结构,不得增行或删行。import java.awt.*;import java.applet.*;import java.1ang*;public class exl3_3 extends Appletprivate TextField tf;privat

6、e Button btn;public void init()tf=new TextField(25);add(tf);btn=new Bunon(“统计“);add(btn);resize(250,200);pubhc void paint(Graphics g)Stling str=tf.genText();shon cnt=new shon65536;int i;int n = 50;for(i=0;i65536;i+)cati=0;for(i=0;istr.length();i+)cnti+;for(i=0;i65536;i+)/对数组 Cnt进行初始化if(cnti=0)g.draw

7、String(i+“出现“+cnti+“次“,50,n);n+=20;public boolean action(Eyent e,Object o)if(o=“统计“)repaint();return true;elsereturn false;ex13_3.htmlHTMLHEADTITLEex13_3/TITLE/HEADBODYapplet code=“ex13_3.class“width=800 height=400/applet/BODY/HTML(分数:34.00)_正确答案:(cntstr.charAt(i)+cnti0g.drawString(char)i+“出现“+cnti+“次“,50,n)解析:

展开阅读全文
相关资源
猜你喜欢
  • TCVN 7304-2-2003 Biological preparation Part 2 Microorganism for water closet treatment Liquid《生物制备 第2部分 抽水马桶处理用微生物 液体》.pdf TCVN 7304-2-2003 Biological preparation Part 2 Microorganism for water closet treatment Liquid《生物制备 第2部分 抽水马桶处理用微生物 液体》.pdf
  • TCVN 7305-1-2008 Plastics piping systems Polyethylene (PE) pipes and fittings for water supply Part 1 General《塑料管道系统 供水用聚乙烯管和配件 第1部分 总则》.pdf TCVN 7305-1-2008 Plastics piping systems Polyethylene (PE) pipes and fittings for water supply Part 1 General《塑料管道系统 供水用聚乙烯管和配件 第1部分 总则》.pdf
  • TCVN 7305-2-2008 Plastics piping systems Polyethylene (PE) pipes and fittings for water supply Part 2 Pipes《塑料管道系统 供水用聚乙烯管和配件 第2部分 管道》.pdf TCVN 7305-2-2008 Plastics piping systems Polyethylene (PE) pipes and fittings for water supply Part 2 Pipes《塑料管道系统 供水用聚乙烯管和配件 第2部分 管道》.pdf
  • TCVN 7305-3-2008 Plastics piping systems Polyethylene (PE) pipes and fittings for water supply Part 3 Fittings《塑料管道系统 供水用聚乙烯管和配件 第3部分 管件》.pdf TCVN 7305-3-2008 Plastics piping systems Polyethylene (PE) pipes and fittings for water supply Part 3 Fittings《塑料管道系统 供水用聚乙烯管和配件 第3部分 管件》.pdf
  • TCVN 7305-5-2008 Plastics piping systems Polyethylene (PE) pipes and fittings for water supply Part 5 Fitness for purpose of the system《塑料管道系统 供水用聚乙烯管和配件 第5部分 系统的适合性》.pdf TCVN 7305-5-2008 Plastics piping systems Polyethylene (PE) pipes and fittings for water supply Part 5 Fitness for purpose of the system《塑料管道系统 供水用聚乙烯管和配件 第5部分 系统的适合性》.pdf
  • TCVN 7306-2008 Unplasticized poly(vinyl chloride) (PVC-U) pipes Dichloromethane resistance at specified temperature (DCMT) Test method《未增塑聚氯乙烯管 特定温度下二氯甲烷的阻力 试验方法》.pdf TCVN 7306-2008 Unplasticized poly(vinyl chloride) (PVC-U) pipes Dichloromethane resistance at specified temperature (DCMT) Test method《未增塑聚氯乙烯管 特定温度下二氯甲烷的阻力 试验方法》.pdf
  • TCVN 7307-2007 Glass containers Internal pressure resistance Test methods《玻璃容器 抗内压性 试验方法》.pdf TCVN 7307-2007 Glass containers Internal pressure resistance Test methods《玻璃容器 抗内压性 试验方法》.pdf
  • TCVN 7308-2007 Glass containers Thermal shock resistance and thermal shock endurance Test methods《玻璃容器 耐热震性和热冲击耐力 试验方法》.pdf TCVN 7308-2007 Glass containers Thermal shock resistance and thermal shock endurance Test methods《玻璃容器 耐热震性和热冲击耐力 试验方法》.pdf
  • TCVN 7309-2007 Glass containers Determination of capacity by gravimetric method Test method《玻璃容器 通过重量分析法对容量进行测定 试验方法》.pdf TCVN 7309-2007 Glass containers Determination of capacity by gravimetric method Test method《玻璃容器 通过重量分析法对容量进行测定 试验方法》.pdf
  • 相关搜索

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

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