2019 Java语言程序设计(华东交通大学)1206118237 最新满分章节测试答案
- 数据类型与表达式 第2章的单元测验
- 流程控制语句 第3章单元测验
- 【作业】流程控制语句 流程控制语句的使用
- 【作业】数组和方法 数组应用单元作业
- 类与对象 类与对象的测验
- 【作业】常用数据类型处理类 常用系统类的使用
- 继承与多态 继承与多态的测试
- 抽象类、接口及内嵌类 抽象类与接口测验
- 异常处理 异常处理单元测验
- 【作业】Java图形绘制 图形绘制作业
- 【作业】图形界面编程基础 图形界面事件处理编程作业
- 【作业】文件操作与输入输出流 文件数据的读取
- 【作业】多线程 多线程编程作业
- 【作业】泛型、收集API 数组列表的使用
- 【作业】泛型、收集API Map接口的应用
- 【作业】Swing图形界面编程 Swing编程作业
本答案对应课程为:点我自动跳转查看
本课程起止时间为:2019-03-18到2019-05-09
本篇答案更新状态:已完结
数据类型与表达式 第2章的单元测验
1、 问题:一个 int 类型的整数和一个 double 类型的数进行加法运算,则结果类型为
选项:
A:int
B:double
C:float
D:long
答案: 【double】
2、 问题:设 a = 8,则表达式 a >>> 2 的值是
选项:
A:16
B:2
C:8
D:4
答案: 【2】
3、 问题:用八进制表达 8 的值,正确的是?
选项:
A:0x10
B:010
C:08
D:0x8
答案: 【010】
4、 问题:要产生[20,999]之间的随机整数使用( )表达式。
选项:
A:(int)(20+Math.random()979)
B:20+(int)(Math.random()980)
C:(int)Math.random()999
D:20+(int)Math.random()980
答案: 【20+(int)(Math.random()*980)】
5、 问题:表达式 1+2+ "x"+3 的值是
选项:
A:"12×3"
B:"3×3"
C:"6x"
D:"x6"
答案: 【"3×3"】
6、 问题:整型变量a,b的值定义如下: int a = 21; int b = 22;则表达式 ++a == b++ 的值为:
选项:
A:false
B:21
C:true
D:22
答案: 【true】
7、 问题:下列叙述中,正确的是?
选项:
A:声明变量时必须指定一个类型
B:java认为变量number与Number相同
C:Java中唯一的注释方式是"//"
D:一个源文件中public类可以有0或多个
答案: 【声明变量时必须指定一个类型】
8、 问题:下列选项中( )是合法的 Java 标识符名字。
选项:
A:$index
B:name-7
C:_byte
D:char
答案: 【$index;
_byte】
9、 问题:下面各项中定义变量及赋值正确的有( )。
选项:
A:int i = 32;
B:float f = 45.0;
C:double d = 45.0;
D:long x = (long)45.0;
答案: 【int i = 32;;
double d = 45.0; ;
long x = (long)45.0;】
10、 问题:设有类型定义 int x=24;long y=25;下列赋值语句正确的是
选项:
A:y=x;
B:x=y;
C:x=(int)y;
D:y=x+2;
答案: 【y=x; ;
x=(int)y;;
y=x+2;】
11、 问题:以下哪些编译正确?
选项:
A:short myshort = 99S;
B:String name = ‘Excellent tutorial Mr Green’;
C:char c = 17;
D:int z = 015;
答案: 【char c = 17;;
int z = 015;】
12、 问题:思考程序段对应的运行结果int a = 2;System.out.print( a++);
答案: 【2】
13、 问题:写出程序段对应的运行结果int x = 4;System.out.print( "x=" +((x > 4) ? 99.99 : 9));
答案: 【9.0】
14、 问题:写出程序段对应的输出结果int x = 125;System.out.print(x/10);
答案: 【12】
15、 问题:写出程序段对应的运行结果int x = 125;System.out.print(x%3==0);
答案: 【false】
流程控制语句 第3章单元测验
1、 问题:以下程序的运行结果为( )。public class Test { public static void main(String args[ ]) { int i=0, j=2; do { i=++i; j–; } while(j>0); System.out.println(i); }}
选项:
A:0
B:1
C:2
D:3
答案: 【2】
2、 问题:执行以下程序后,输出结果为( )。public class Ex2{ public static void main(String args[ ]) { int k ,f=1; for (k=2;k<5;k++) f = f * k; System.out.println(k); }}
选项:
A:1
B:4
C:5
D:24
答案: 【5】
3、 问题:设有如下类:class Loop{ public static void main(String[ ] args) { int x=0;int y=0; outer: for(x=0;x<100;x++){ middle: for(y=0;y<100;y++){ System.out.println("x="+x+"; y="+y); if (y==10) { <<<insert code>>> } } } }}在<<<insert code>>>处插入什么代码可以结束外循环?
选项:
A:continue middle;
B:break outer;
C:break middle;
D:continue outer;
答案: 【break outer;】
4、 问题:以下循环的执行次数是( )。int x=4,y=2;while (–x!=x/y) { }
选项:
A:1
B:2
C:3
D:4
答案: 【3】
5、 问题:以下程序段的输出结果为( )。int x=1;for (x=2;x<=10;x++ ) ;System.out.print(x);
选项:
A:1
B:2
C:10
D:11
答案: 【11】
6、 问题:设 int x=2,y=3,则表达式(y-x==1)?(!true?1:2):(false?3:4)的值为( )。
选项:
A:1
B:2
C:3
D:4
答案: 【2】
7、 问题:outer: for( int i =1; i<3 ;i++) { inner : for ( j= 1;j<3;j++) { if (j==2) continue outer: System.out.prinltn("i= " + i ",j = " + j) } } 该代码段的输出结果含有?
选项:
A:i= 1,j= 1
B:i= 1,j= 2
C:i= 2,j= 1
D:i= 2,j= 2
答案: 【i= 1,j= 1 ;
i= 2,j= 1】
8、 问题:设有如下代码 switch (x) { case 1 : System.out.println("Test1"); case 2 : case 3 : System.out.println("Test2"); break; } System.out.println("Test3");} x为哪些数时输出内容中含有 "Test2" ?
选项:
A:0
B:1
C:2
D:3
答案: 【1;
2;
3】
9、 问题:写出以下程序段对应的运行结果String c="red"; switch (c) { default: System.out.println("white"); case "red": System.out.println("red"); break; case "blue": System.out.println("blue"); }
答案: 【red】
10、 问题:写出以下程序段对应的输出结果int x = 23659;String m = "result=";while (x>0) { m = m + x%10; x = x/10;}System.out.println(m);
答案: 【result=95632】
11、 问题:写出以下程序段对应的执行结果int i = 10,j = 10;boolean b = false;if ( b = i == j) System.out.println("True");else System.out.println("False");
本文章不含期末不含主观题!!
本文章不含期末不含主观题!!
支付后可长期查看
有疑问请添加客服QQ 2356025045反馈
如遇卡顿看不了请换个浏览器即可打开
请看清楚了再购买哦,电子资源购买后不支持退款哦