2022大学慕课答案 Java程序设计(河南师范大学) 最新大学MOOC满分章节测试答案
本答案对应课程为:点我自动跳转查看
本课程起止时间为:2020-02-19到2020-07-01
本篇答案更新状态:已完结
01 Java开发入门 第1次测试
1、 问题:已知:class C { public static void main(String[] args) { System.out.println(++i); }}在命令行中编译上面的代码,应使用
选项:
A:java C
B:java C.java
C:javac C
D:javac C.java
答案: 【javac C.java】
2、 问题:Java 中 char 类型的数据长度为
选项:
A:8 位
B:16 位
C:32 位
D:64 位
答案: 【16 位】
3、 问题:Java 编译输出文件的后缀是
选项:
A:.exe
B:.java
C:.class
D:.obj
答案: 【.class】
4、 问题:已知:class C { public static void main(String[] args) { int a = 1; int b = 2; System.out.print(“7” + 5 + 4); System.out.print(m() + a + 3); System.out.println(a + b + m()); } public static String m() { return “6”; }}
选项:
A:79613126
B:79614336
C:75461336
D:754613126
答案: 【75461336】
5、 问题:下面代码的输出是class C { public static void main(String[] args) { int x = 1; System.out.print((x > 1) & (x++ > 1)); System.out.print(“ ”); System.out.print((x > 1) && (x++ > 1)); }}
选项:
A:false true
B:true false
C:false false
D:true true
答案: 【false true】
6、 问题:float[] f = new float[10],则 f[0]的值为
选项:
A:0.0
B:0.0f
C:null
D:false
答案: 【0.0f】
7、 问题:已知:class C { public static void main(String[] args) { int i = 10; System.out.println(i < 8 ? 1 : 2); }}
选项:
A:1
B:2
C:8
D:10
答案: 【2】
8、 问题:public class Test { public static void main(String[] args) { int a = 0; int b = 0; for (int i = 1; i <= 5; i++) { a = i % 2; while (a– >= 0) { b++; } } System.out.println("a=" + a + ",b=" + b); }}下列选项中,哪一个是正确的运行结果
选项:
A:a=2,b=-8
B:a=-2,b=8
C:a=-2,b=-8
D:a=2,b=8
答案: 【a=-2,b=8】
9、 问题:class C { public static void main(String[] args) { int[] array = new int[10]; increase(array); System.out.print(array[0]); } public static void increase(int[] array) { for(int i = 0; i < array.length; i++) { array[i]++; } }}则输出为
选项:
A:0
B:1
C:2
D:10
答案: 【1】
10、 问题:已知:class C { public static void main(String[] args) { for(int i = 0; i <= 10; i++) { if(i > 7) { break; } } System.out.println(i); }}的输出为
选项:
A:7
B:8
C:10
D:编译错误
答案: 【编译错误】
11、 问题:已知:class C { public static void main(String[] args) { System.out.println(9 ^ 2); }}则输出为
选项:
A:81
B:11
C:7
D:0
答案: 【11】
12、 问题:swtich(expression)语句中表达式的类型可以是
选项:
A:String
B:char
C:short
D:double
答案: 【String;
char;
short】
13、 问题:下面的哪些声明是合法的?
选项:
A:int a[];
B:int a[5];
C:int[] a;
D:int a[] = [5];
答案: 【int a[];;
int[] a;】
14、 问题:下面哪个语句是正确的
选项:
A:short s = 256;
B:String s = ‘Hello world’;
C:int x = 012;
D:char c = “a”;
答案: 【short s = 256;;
int x = 012;】
15、 问题:下面哪些标识符是合法的
选项:
A:s1
B:$1
C:_1
D:1s
答案: 【s1;
$1;
_1】
16、 问题:下面哪些代码可以正确编译
选项:
A:double d = 1.0; int i = 1; if(d == i) { System.out.println(“Hello world”); }
B:int i = 1; int j = 2; if(i = 1 && j = 2) { System.out.println(“Hello world”); }
C:boolean b1 = true, b2 = false; if(b1 == b2) { System.out.println(“Hello world”);}
D:int i = 0; if(i) { System.out.println(“Hello world”); }
答案: 【double d = 1.0; int i = 1; if(d == i) { System.out.println(“Hello world”); };
boolean b1 = true, b2 = false; if(b1 == b2) { System.out.println(“Hello world”);}】
17、 问题:下面哪些类型属于 Java 基本数据类型
选项:
A:int
B:Boolean
C:uint
D:double
答案: 【int;
double】
18、 问题:java 中的标识符可以是任意长度。
选项:
A:正确
B:错误
答案: 【正确】
19、 问题:一个源文件中只能包含一个类。
选项:
本文章不含期末不含主观题!!
本文章不含期末不含主观题!!
支付后可长期查看
有疑问请添加客服QQ 2356025045反馈
如遇卡顿看不了请换个浏览器即可打开
请看清楚了再购买哦,电子资源购买后不支持退款哦