[计算机类试卷]国家二级(JAVA)机试模拟试卷93及答案与解析.doc

上传人:吴艺期 文档编号:503631 上传时间:2018-11-29 格式:DOC 页数:4 大小:145.50KB
下载 相关 举报
[计算机类试卷]国家二级(JAVA)机试模拟试卷93及答案与解析.doc_第1页
第1页 / 共4页
[计算机类试卷]国家二级(JAVA)机试模拟试卷93及答案与解析.doc_第2页
第2页 / 共4页
[计算机类试卷]国家二级(JAVA)机试模拟试卷93及答案与解析.doc_第3页
第3页 / 共4页
[计算机类试卷]国家二级(JAVA)机试模拟试卷93及答案与解析.doc_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

1、国家二级( JAVA)机试模拟试卷 93及答案与解析 一、基本操作题( 30分) 1 程序如下: 计算两个整数的乘法 Java_1. java import javax, swing. JOptionPane; public class Java_1 public static void main(String args ) int x, y, result; String xVal, yVal; xVal = JOptionPane. showInputDialog(“输入第 1个整数 :“); yVal = JOptionPane. showInputDialog(“输入第2个整数 :“)

2、 * Found * x = Integer. parseInt( (1) ); y = Integer. parseInt(yVal); result = x * y; * Found * JOptionPane. (2) ( null,“两个数的积 :“+result); System. exit(0); 二、简单应用题( 40分 ) 2 程序如下: Java_2.java public class Java_2 public static void main( String args) int aMatrix=(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4; int

3、i=0; 循环变量 int j=0; 循环变量 * Found * for(i=0;i (3) ;i+) for(j=0;j aMatrixi, length;j+) * Found * System. out. print( (4) +“ “); System. out. println( ); 三、综合应用题( 30分) 3 程序如下: Java_3. java import java. awt. *; import javax, swing. *; * Found * public class Java_3 ( 5 ) JApplet * Found * public void ( 6

4、) ( ) Container contentPane=getContentPane( ); JLabel label=new JLabel(“Java的诞生是对传统计算模式的挑战 !“, SwingConstants. CENTER); * Found * contentPane, add ( ( 7 ) ); Java_3. html html applet code=“Java_3. class“width=300 height=50 /applet /html 国家二级( JAVA)机试模拟试卷 93答案与解析 一、基本操作题( 30分) 1 【正确答案】 1.xVal 2.showM

5、essageDialog 【试题解析】 本题首先要将用户输入的数字字符转换成 int型的十进制数,所以调用 parseInt(String str)方法将 xVal和 yVal转换成 int型,所以第一处应填入“xVal”。 JOption- Pane.showMessageDialog()方法用于显示消息对话框,所以第二处应填入 “ShowMessageDialog”。 二、简单应用题( 40分) 2 【正确答案】 3.aMatrix.length 4.aMatrixij 【试题解析】 程序中,变量 i索引数组中元素的行号,变量 j索引每一行中元素的列号。在外层循环中, i不能超过二维数组的

6、行数,即 i要小于数组的长度,所以 i aM- atrix.length;第二处要求输出元素,对于二维数组索引而言,应表示为aMatrixij,即第 i行第 j列位置上的元素。 三、综合应用题( 30分) 3 【正确答案】 5.extends 6.init 7.label 【试题解析】 很显然, Java_3类继承自 JApplet类,所以第一处应填入“extends”,表明 Java_3与 JApplet之间的继承关系。对于 Applet的定义接下来要进行初始化工作,即重载 init( )方法,所以第二处应填入 “init。第三处要在顶层容器的内容面板中添加一个定义好的 JLabel,所以应填入 “label”。

展开阅读全文
相关资源
猜你喜欢
  • AECMA PREN 2591-D27-1992 Aerospace Series Elements of Electrical and Optical Connection Test Methods Part D27 - Robustness of Protective Cover Attachment Issue P 1《航空航天系列.光电连接元件 试验.pdf AECMA PREN 2591-D27-1992 Aerospace Series Elements of Electrical and Optical Connection Test Methods Part D27 - Robustness of Protective Cover Attachment Issue P 1《航空航天系列.光电连接元件 试验.pdf
  • AECMA PREN 2591-D28-1993 Aerospace Series Elements of Electrical and Optical Connection Test Methods Part D28 - Sinusoidal Vibrations with Passage of Current for Lugs and in-Line S.pdf AECMA PREN 2591-D28-1993 Aerospace Series Elements of Electrical and Optical Connection Test Methods Part D28 - Sinusoidal Vibrations with Passage of Current for Lugs and in-Line S.pdf
  • AECMA PREN 2591-D4-1992 Aerospace Series Elements of Electrical and Optical Connection Test Methods Part D4 - Transverse Load (External Bending Moment) Issue P 1《航空航天系列.光电连接元件 试验方法.pdf AECMA PREN 2591-D4-1992 Aerospace Series Elements of Electrical and Optical Connection Test Methods Part D4 - Transverse Load (External Bending Moment) Issue P 1《航空航天系列.光电连接元件 试验方法.pdf
  • AECMA PREN 2591-D5-1992 Aerospace Series Elements of Electrical and Optical Connection Test Methods Part D5 - Axial Load Issue P 1《航空航天系列.光电连接元件 试验方法 D5部分 轴向-载》.pdf AECMA PREN 2591-D5-1992 Aerospace Series Elements of Electrical and Optical Connection Test Methods Part D5 - Axial Load Issue P 1《航空航天系列.光电连接元件 试验方法 D5部分 轴向-载》.pdf
  • AECMA PREN 2591-D6-1992 Aerospace Series Elements of Electrical and Optical Connection Test Methods Part D6 - Mechanical Endurance Issue P 1《航空航天系列.光电连接元件 试验方法 D6部分 机械寿命》.pdf AECMA PREN 2591-D6-1992 Aerospace Series Elements of Electrical and Optical Connection Test Methods Part D6 - Mechanical Endurance Issue P 1《航空航天系列.光电连接元件 试验方法 D6部分 机械寿命》.pdf
  • AECMA PREN 2591-D7-1992 Aerospace Series Elements of Electrical and Optical Connection Test Methods Part D7 - Durability of Contact Retention System and Seals (Maintenance Ageing) .pdf AECMA PREN 2591-D7-1992 Aerospace Series Elements of Electrical and Optical Connection Test Methods Part D7 - Durability of Contact Retention System and Seals (Maintenance Ageing) .pdf
  • AECMA PREN 2591-D8-1992 Aerospace Series Elements of Electrical and Optical Connection Test Methods Part D8 - Mating and Unmating Forces Issue P 1《航空航天系列.光电连接元件 试验方法 D8部分 啮合和非啮合力》.pdf AECMA PREN 2591-D8-1992 Aerospace Series Elements of Electrical and Optical Connection Test Methods Part D8 - Mating and Unmating Forces Issue P 1《航空航天系列.光电连接元件 试验方法 D8部分 啮合和非啮合力》.pdf
  • AECMA PREN 2591-D9-1992 Aerospace Series Elements of Electrical and Optical Connection Test Methods Part D9 - Contact Retention in Insert Issue P 1《航空航天系列.光电连接的元件 试验方法 D9部分 触点插入保持》.pdf AECMA PREN 2591-D9-1992 Aerospace Series Elements of Electrical and Optical Connection Test Methods Part D9 - Contact Retention in Insert Issue P 1《航空航天系列.光电连接的元件 试验方法 D9部分 触点插入保持》.pdf
  • AECMA PREN 2591-E1-1993 Aerospace Series Elements of Electrical and Optical Conncetion Test Methods Part E1 - Soft Soldering《航空航天系列.光电连接元件 试验方法 E1部分 软钎焊》.pdf AECMA PREN 2591-E1-1993 Aerospace Series Elements of Electrical and Optical Conncetion Test Methods Part E1 - Soft Soldering《航空航天系列.光电连接元件 试验方法 E1部分 软钎焊》.pdf
  • 相关搜索

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

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