选择题
1:在软件生命周期中,下列哪个说法是不准确的?
厂A.软件生命周期分为计划、开发和运行三个阶段
厂B.在计划阶段要进行问题焉醛和需求分析
「C•在开发后期要进行编写代码和软件测试
D.在运行阶段主要是进行软件维护
2:
Whichisthemostappropriatecodesnippetthatcanbeinrtedatline18inthefollowingcode?
(Assumethatthecodeiscompiledandrunwithasrtionnabled)
.*;
2.
classAsrtTest
3.{
eHashMapcctld;
6.
AsrtTest()
8.
{
=newHashMap();
("in","India");
("uk","UnitedKingdom");
("au","Australia");
13.//morecode...
14.}
15.//othermethods....
StringgetCountry(StringcountryCode)
17.{
18.//Whatshouldbeinrtedhere?
country=(String)(countryCode);
country;
21.}
22.}
Whichisthemostappropriatecodesnippetthatcanbeinrtedatline18inthefollowingcode?
(Assumethatthecodeiscompiledandrunwithasrtionnabled)
.*;
2.
classAsrtTest
4.{
eHashMapcctld;
6.
AsrtTest()
6.{
=newHashMap();
("in","India");
("uk","UnitedKingdom");
("au","Australia");
11.//morecode...
12.}
13.//othermethods....
publicStringgetCountry(StringcountryCode)
{
//Whatshouldbeinrtedhere?
Stringcountry=(String)(countryCode);
returncountry;
}
countryCode!=null;
r
countryCode!=null:"CountrycodecannotbenuII";
r
cctld!=null:"Nocountrycodedataisavailable";
r
cctld:"Nocountrycodedataisavailable";
3:
Givethefollowingcode:
publicclassExample{
publicstaticvoidmain(Stringargs[]){
intl=0;
do{
n("ItCforrlgis:”+l);
}while(--l>0)
n(“Finish”);
}
}
Whichwellbeoutput:
Givethefollowingcode:
publicclassExample{
publicstaticvoidmain(Stringargs[]){
intl=0;
do{
n(“Doingitforlis:”+l);
}while(--l>0)
16.
17.
18.
19.
20.
21.
22.}
r
n(
}
}
Whichwellbeoutput:
r
tforlis3
厂tforlis1
厂tforlis2
r
tforlis04:
Givethisclassoutline:
classExample{
privateintx;
//restofclassbody…
}
AssumingthatxinvokedbythecodejavaExample,whichstatementcanmadexbedirectlyacces
sibleinmain()?
Givethisclassoutline:
classExample{
privateintx;
//restofclassbody…
}
AssumingthatxinvokedbythecodejavaExample,whichstatementcanmadexbedirectly
accessibleinmain()?
r
privateintxtopublicintx
r
privateintxtostaticintx
r
privateintxtoprotectedintx
r
privateintxtofinalintx5:Whichofthefollowingstatementsarenotlegal?
=4990;
=4L;
厂d=34.4;
t=0.9F.
“Finish”);
6:鉴于Java的特点,它最适合的计算环境是
A.并行计算环境
B.分布式计算环境
C.高强度计算环境
“D.开放式计算环境
7:Whatiswrittentothestandardoutputgiventhefollowingstatement:n(4|7);
Selecttherightanswer:
rL.4
B.5
8:
classX{
objectm(){
o=newfloat(3.14F);
[]oa=newobject[1];
[0]=o;
6.o=null;
[0]=null;
o;
9.}
10.}
Whenisthefloatobjectcreatedinline3,eligibleforgarbagecollection?
classX{
objectm(){
o=newfloat(3.14F);
[]oa=newobject[1];
[0]=o;
6.o=null;
[0]=null;
o;
9.}
10.}
Whenisthefloatobjectcreatedinline3,eligibleforgarbagecollection?
terline5
terline6
C.6
D.7
terline7
r
terline8(thatis,asthemethodreturns)
9:Considertheclasshierarchyshownbelow:classFourWheelerimplementsDrivingUtilitiesclass
CarextendsFourWheeler
classTruckextendsFourWheeler
classBuxtendsFourWheeler
classCraneextendsFourWheeler
Considerthefollowingcodebelow:
gUtilitiesdu;
eelerfw;
yTruck=newTruck();
=(DrivingUtilities)myTruck;
=newCrane();
=du;
Whichofthestatementsbelowaretrue?
Choices:
r
4willnotcompilebecauaninterfacecannotrefertoanobject.
ewillcompileandrun.
ewillnotcompilewithoutanexplicitcastatline6,becaugoingdownthe
hierarchywithoutcastingisnotallowed.
r
ewillcompileifweputanexplicitcastatline6butwillthrowanexception
runtime.
10:
Givethefollowingmethod:
publicvoidmethod(){
Stringa,b;
a=newString(“heihorld”);
b=newString(“gaomer”);
n(a+b+”ok”);
a=null;
a=b;
n(a);
}
Intheabnceofcompileroptimization,whichistheearliestpointtheobjectareferedisdefinitely
elibiletobegarbagecollection.
Givethefollowingmethod:
publicvoidmethod(){
Stringa,b;
a=newString(“helloworld”);
b=newString(“gameover”);
n(a+b+”ok”);
a=null;
a=b;
n(a);
}
Intheabnceofcompileroptimization,whichistheearliestpointtheobjectarefereddefinitely
elibiletobegarbagecollection.
r
line5
r
line6
r
line7
r
line9
11:
Whatwillhappenwhenyouattempttocompileandrunthefollowingcode?
publicclassStatic
static
{
at
is
{
intx=5;
}
staticintx,y;
publicstaticvoidmain(Stringargs[])
{
x--;
myMethod();
n(x+y+++x);
}
publicstaticvoidmyMethod()
{
y=x+++++x;
}
}
Choices:
Whatwillhappenwhenyouattempttocompileandrunthefollowingcode?publicclassStatic
{
static
intx=5;
}
staticintx,y;
publicstaticvoidmain(Stringargs[])
{
x--;
myMethod();
n(x+y+++x);
}
publicstaticvoidmyMethod()
{
y=x+++++x;
}
}
Choices:
r
:2
r
:3
r
:7
r
:8
12:
Whatwillbetheresultofexecutingthefollowingcode?
publicstaticvoidmain(Stringargs[])
{
chardigit='a';
for(inti=0;i<10;i++)
{
switch(digit)
{
ca'x':
{
intj=0;
n(j);
}
default:
{
intj=100;
n(j);
}
}
}
inti=j;
n(i);
}
Choices:
Whatwillbetheresultofexecutingthefollowingcode?
publicstaticvoidmain(Stringargs[])
{
chardigit='a';
for(inti=0;i<10;i++)
{switch(digit)
{
ca'x':
{
intj=0;
n(j);
}default:
{
intj=100;
n(j);
}
}
}
inti=j;
n(i);
Choices:
r
A.100willbeprinted11times.
r
ewillnotcompilebecauthevariableicannotbedeclaredtwicewithinthe
main()method.
广
ewillnotcompilebecauthevariablejcannotbedeclaredtwicewithinthe
switchstatement.
r
the.
13:软件生命周期的瀑布模型把软件项目分为3个阶段、8个子阶段,以下哪一个是正常的开
发顺序?
「A.计划阶段、开发阶段、运行阶段
厂B.设计阶段、开发阶段、编码阶段
厂C.设计阶段、编码阶段、维护阶段
“D.计划阶段、编码阶段、测试阶段
14:设有变量说明语句inta=1,b=0;
则执行以下程序段的输出结果为()。
switch(a)
{
ca1:
switch(b)
{
ca0:printf("**O**");break;
ca1:printf("**1**");break;
}
ca2:printf("**2**");break;
}
printf("n");
r
**0**
o
B**0****2**
r
**0****1****2**
D.有语法错误
15:
Whatwillhappenwhenyouattempttocompileandrunthefollowingcode?classBa
{
inti=99;
publicvoidamethod()
{
n("d()");
}
Ba()
{
amethod();
}
}
publicclassDerivedextendsBa
{
inti=-1;
publicstaticvoidmain(Stringargv[])
{
Bab=newDerived();
n(b.i);
d();
{
publicvoidamethod()
{
n("d()");
}
}
Choices:
Whatwillhappenwhenyouattempttocompileandrunthefollowingcode?classBa
{
inti=99;
publicvoidamethod()
{
n("d()");
}
Ba()
{
amethod();
}
}
publicclassDerivedextendsBa
inti=-1;
publicstaticvoidmain(Stringargv[])
36
{
Bab=newDerived。;
n(b.i);
d();
}
publicvoidamethod()
{
n("d()");
}
Choices:
r
d()-d()
r
d()99
r
etimeerror
r
d()
简答题
16:写一个方法,删除JAVA源文件中的注释,
17:是否可以继承String类?
18:写一个程序做低于256位整数的运算,并有如下输出
比如输入:12,23输出:
12
*23
24276
19:abstractclassName{
privateStringname;
publicabstractbooleanisStupidName(Stringname){}
}
这有何错误?
20:hibernate有那些抓取策略?
21:请问你在什么情况下会在你的JAVA代码中使用可序列化?为什么放到HttpSession中的对象必
须要是可序列化的?
22:说明Jsp中errorPage的作用,应用范围。
23:Overload和Override的区别。Overloaded的方法是否可以改变返回值的类型?
24:两个对象值相同((y)==true),但却可有不同的hashcode,这句话对不对?
25:耶稣有13个门徒,其中有一个就是出卖耶稣的叛徒,请用排除法找出这位叛徒:13人围
坐一圈,从第一个开始报号:1,2,3,1,2,3……,凡是报到“3就退出圈子,最后留在
圈内的人就是出卖耶稣的叛徒,请找出它原来的序号。
本文发布于:2022-11-27 02:24:34,感谢您对本站的认可!
本文链接:http://www.wtabcd.cn/fanwen/fan/90/28195.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |