- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
2012——2013学年第二学期
课程名称: Java Programming 考试时 间 120 Minutes
专业 2010 年级 班 学号 姓名
题号
—?
?
-
四
11.
总得分
得分
评卷人签字
复核人签字
S
—、选择题(每题1分,共10分)
下面变量声明屮存在错误的是
(b)
double x = 14.7;
int y = x;
double x = 14.7;
int y = (int) x;
intx= 14;
double y = x;
(D) III only(D) 22 is negativeNone (B) I only (C) II only
(D) III only
(D) 22 is negative
下血程序片段的输出是
(cl )
int num = 22;
if (num 0)
if (num % 5 == 0)
System.out.println(num);
else
System.out.println(num + M is negative11);
22 (B) 4 (C) 2 is negative
下面程序片段的输出是
(d )
int x = 10, y = 0;
while (x 5) {
y = 3;
while (y x) {
y *二 2;
讦(y % x == 1)
y +二 x;
}
x ?=3;
}
System.out.prin什n(x + + y);
1 6 (B)7 12 (C) -3 12 (D) 4 12
我们用字符0,1,..., 8, 9, A, B, C, D, E, F来表示16进制数,其中A = 10, B =
11,...,F= 15, 2位16进制数(如14,3A等)能表示的最大10进制数是 ( c)
32 (B) 225 (C) 255 (D) 256
类Clown有一个无参构造函数,类型为ArrayListClown的变量list已经初始化,
卜面会产生IndexOutOfBoundsException错误的是 ( a )
for (int i = 0; i = list.size(); i++)
list.sct(i, new Clown());
list.add(list.size(), new Clown());
Clown c = list.get(list.size());
Clown c = list.remove(list.size());
下面接口定义存在的错误是
(cl )
public interface Bad {
void somcMcthod(String password) {
System.out.println(uPsst! The password is n + password);
}
}
A method in an interface should be declared public.
A method in an interface should be declared abstract.
There should not be a method implementation.
There should be a class implementation provided.
假设一个求N个数的平均数的算法存在语句average = sum / N,其屮N和sum 都是整数。在一个使用该算法的程序中,程序员忘记对N是否为0进行检查。如果
N等于0,错误被发现的时刻是 (d )
At compile time
At edit time
As soon as the value of N is entered
During run time
This question is based on the following declarations:
String strA = CARROT, strB = Carrot, strC = car;
假设大写字母小于小写字母,下面表达式为true的是 (c )
strA.compareTo(strB) 0 strB.compareTo(strC) 0
strC.comparcTo(strB) 0 strB.comparcTo(strA) 0
strB.compareTo(strC) 0 strB.compareTo(strA) 0
!(strA.compareTo(strB) == 0) sirB.compareTo(strA) 0
Refer to the ncxtlntlnRangc method below:
/* Postcondition:返回一个low到high的随机整数(包括low和high)
文档评论(0)